From 49d9e5eb2d8a18e9460b5b80925dbe142f4634ae Mon Sep 17 00:00:00 2001 From: Hooray <304327508@qq.com> Date: Sat, 25 Feb 2023 19:06:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=97=A0=E6=9D=83=E9=99=90?= =?UTF-8?q?=E8=B7=AF=E7=94=B1=E7=9A=84=E8=BF=87=E6=BB=A4=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/route.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/store/modules/route.ts b/src/store/modules/route.ts index 54bce584..a222a373 100644 --- a/src/store/modules/route.ts +++ b/src/store/modules/route.ts @@ -176,14 +176,14 @@ const useRouteStore = defineStore( const res: any = [] routes.forEach((route) => { const tmpRoute = cloneDeep(route) - if (tmpRoute.children) { - tmpRoute.children = filterAsyncRoutesNoAuth(tmpRoute.children, permissions) - tmpRoute.children.length && res.push(tmpRoute) + if (hasPermission(permissions, route)) { + if (tmpRoute.children) { + tmpRoute.children = filterAsyncRoutesNoAuth(tmpRoute.children, permissions) + tmpRoute.children.length && res.push(tmpRoute) + } } else { - if (!hasPermission(permissions, route)) { - res.push(tmpRoute) - } + res.push(tmpRoute) } }) return res