diff --git a/web/src/layout/components/sidebar/components/SideMenu.vue b/web/src/layout/components/sidebar/components/SideMenu.vue index ee8d14b..3822c32 100644 --- a/web/src/layout/components/sidebar/components/SideMenu.vue +++ b/web/src/layout/components/sidebar/components/SideMenu.vue @@ -59,32 +59,10 @@ function getMenuItem(route, basePath = '') { if (!visibleChildren.length) return menuItem - if (visibleChildren.length === 1) { - // 单个子路由处理 - const singleRoute = visibleChildren[0] - menuItem = { - ...menuItem, - label: singleRoute.meta?.title || singleRoute.name, - key: singleRoute.name, - path: resolvePath(menuItem.path, singleRoute.path), - icon: getIcon(singleRoute.meta), - } - const visibleItems = singleRoute.children - ? singleRoute.children.filter((item) => item.name && !item.isHidden) - : [] + menuItem.children = visibleChildren + .map((item) => getMenuItem(item, menuItem.path)) + .sort((a, b) => a.order - b.order) - if (visibleItems.length === 1) { - menuItem = getMenuItem(visibleItems[0], menuItem.path) - } else if (visibleItems.length > 1) { - menuItem.children = visibleItems - .map((item) => getMenuItem(item, menuItem.path)) - .sort((a, b) => a.order - b.order) - } - } else { - menuItem.children = visibleChildren - .map((item) => getMenuItem(item, menuItem.path)) - .sort((a, b) => a.order - b.order) - } return menuItem }