1
0
mirror of https://github.com/zclzone/vue-naive-admin.git synced 2025-08-08 20:29:00 +08:00

fix: 修复上级菜单隐藏,下级菜单不生成路由问题 (#130)

fix: 修复上级菜单隐藏,下级菜单不生成路由问题
This commit is contained in:
goofy 2025-08-04 09:36:56 +08:00 committed by GitHub
parent 0b69d55765
commit 3c04bbce8e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -28,9 +28,7 @@ export const usePermissionStore = defineStore('permission', {
getMenuItem(item, parent) {
const route = this.generateRoute(item, item.show ? null : parent?.key)
if (item.enable && route.path && !route.path.startsWith('http'))
this.accessRoutes.push(route)
if (!item.show)
return null
this.accessRoutes.push(route)
const menuItem = {
label: route.meta.title,
key: route.name,
@ -48,6 +46,8 @@ export const usePermissionStore = defineStore('permission', {
if (!menuItem.children.length)
delete menuItem.children
}
if (!item.show)
return null
return menuItem
},
generateRoute(item, parentKey) {