修复bug

This commit is contained in:
hero920103 committed 2026-10-19 17:34:11 +08:00
1 parent 1850ac640e
commit 892ba5886d
20 files changed
+1078 -178

No files matched your search

+7 -4
View File
@@ -1,4 +1,5 @@
import { createComponentLoader } from '@/utils/pathResolver';
import { pickDefaultChild } from './menuDefaults';
function computeFullPath(menuPath, parentPath) {
if (!menuPath) return parentPath || '';
@@ -105,7 +106,7 @@ function nestedMenuToRoute(menu, layoutAbsPath) {
component: () => import('@/views/layouts/EmptyLayout.vue'),
children: convertNestedMenuChildren(menu.children, childAbs),
};
const firstChild = menu.children[0];
const firstChild = pickDefaultChild(menu.children);
if (firstChild && firstChild.path) {
const firstAbs = computeFullPath(firstChild.path, childAbs);
const firstRel = toRelativeChildPath(childAbs, firstAbs);
@@ -193,9 +194,11 @@ export function convertMenusToRoutes(menus, parentPath = '') {
} else if (hasChildren) {
route.component = () => import('@/views/layouts/EmptyLayout.vue');
route.children = convertMenusToRoutes(menu.children, fullPath);
const defaultChild = menu.children.find((child) =>
child.path === '/apps/cms/analytics/content' || child.path === 'analytics/content'
) || menu.children[0];
// CMS 内容统计是内置默认页,保持原行为;其余模块统一优先「工作台」
const defaultChild =
menu.children.find(
(child) => child.path === '/apps/cms/analytics/content' || child.path === 'analytics/content'
) || pickDefaultChild(menu.children);
if (defaultChild && defaultChild.path) {
const childFullPath = defaultChild.path.startsWith('/')
? defaultChild.path