Commit b88f042d208b564a55a6bdff3bf5c20b0372bc88

Authored by xingyu
1 parent e78e1a9c

feat: 当只有一个子菜单时显示父级

yudao-ui-admin-vue3/src/utils/routerHelper.ts
... ... @@ -56,7 +56,8 @@ export const generateRoute = (routes: AppCustomRouteRecordRaw[]): AppRouteRecord
56 56 title: route.name,
57 57 icon: route.icon,
58 58 hidden: !route.visible,
59   - noCache: !route.keepAlive
  59 + noCache: !route.keepAlive,
  60 + alwaysShow: route.children && route.children.length == 1 ? true : false
60 61 }
61 62 // 路由地址转首字母大写驼峰,作为路由名称,适配keepAlive
62 63 let data: AppRouteRecordRaw = {
... ... @@ -71,6 +72,7 @@ export const generateRoute = (routes: AppCustomRouteRecordRaw[]): AppRouteRecord
71 72 data.meta = {}
72 73 data.name = toCamelCase(route.path, true) + 'Parent'
73 74 data.redirect = ''
  75 + meta.alwaysShow = true
74 76 const childrenData: AppRouteRecordRaw = {
75 77 path: '',
76 78 name: toCamelCase(route.path, true),
... ...