From e023671bacd9967afd18159a8d74374f8c50d86d Mon Sep 17 00:00:00 2001 From: Hooray Hu <304327508@qq.com> Date: Tue, 14 May 2024 10:14:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=90=8E=E7=AB=AF?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E8=B7=AF=E7=94=B1=E6=95=B0=E6=8D=AE=E4=B8=AD?= =?UTF-8?q?=20children=20=E4=B8=BA=E7=A9=BA=E6=95=B0=E7=BB=84=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E8=8F=9C=E5=8D=95=E6=97=A0=E6=B3=95=E6=AD=A3=E5=B8=B8?= =?UTF-8?q?=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/menu.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/store/modules/menu.ts b/src/store/modules/menu.ts index 3fdf552a..448f9426 100755 --- a/src/store/modules/menu.ts +++ b/src/store/modules/menu.ts @@ -163,11 +163,12 @@ const useMenuStore = defineStore( menus.forEach((menu) => { if (hasPermission(permissions, menu)) { const tmpMenu = cloneDeep(menu) - if (tmpMenu.children) { + if (tmpMenu.children && tmpMenu.children.length > 0) { tmpMenu.children = filterAsyncMenus(tmpMenu.children, permissions) as Menu.recordRaw[] - tmpMenu.children.length && res.push(tmpMenu) + tmpMenu.children.length > 0 && res.push(tmpMenu) } else { + delete tmpMenu.children res.push(tmpMenu) } }