From 3c04bbce8eebe3ee167170a9df4ce75053787c6d Mon Sep 17 00:00:00 2001 From: goofy <30360434+goofy-he@users.noreply.github.com> Date: Mon, 4 Aug 2025 09:36:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=B8=8A=E7=BA=A7?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E9=9A=90=E8=97=8F=EF=BC=8C=E4=B8=8B=E7=BA=A7?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E4=B8=8D=E7=94=9F=E6=88=90=E8=B7=AF=E7=94=B1?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20(#130)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix: 修复上级菜单隐藏,下级菜单不生成路由问题 --- src/store/modules/permission.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index b61a039..61242ec 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -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) {