This commit is contained in:
dap
2025-01-15 15:22:21 +08:00
53 changed files with 267 additions and 126 deletions

View File

@@ -23,6 +23,8 @@ async function generateAccessible(
// 生成路由
const accessibleRoutes = await generateRoutes(mode, options);
const root = router.getRoutes().find((item) => item.path === '/');
// 动态添加到router实例内
accessibleRoutes.forEach((route) => {
/**
@@ -31,9 +33,26 @@ async function generateAccessible(
if (/^https?:\/\//.test(route.path)) {
return;
}
router.addRoute(route);
if (root && !route.meta?.noBasicLayout) {
// 为了兼容之前的版本用法如果包含子路由则将component移除以免出现多层BasicLayout
// 如果你的项目已经跟进了本次修改移除了所有自定义菜单首级的BasicLayout可以将这段if代码删除
// TODO: 这里后期需要follow更新
if (route.children && route.children.length > 0) {
delete route.component;
}
root.children?.push(route);
} else {
router.addRoute(route);
}
});
if (root) {
if (root.name) {
router.removeRoute(root.name);
}
router.addRoute(root);
}
// 生成菜单
const accessibleMenus = await generateMenus(accessibleRoutes, options.router);

View File

@@ -25,6 +25,7 @@ export function useAntdDesignTokens() {
colorSuccess: '',
colorTextBase: '',
colorWarning: '',
zIndexPopupBase: 2000, // 调整基础弹层层级,避免下拉等组件被弹窗或者最大化状态下的表格遮挡
});
const getCssVariableValue = (variable: string, isColor: boolean = true) => {