From f3cc0b0ecb8a540fe6f7a240ceddf965467c621b Mon Sep 17 00:00:00 2001 From: Hooray <304327508@qq.com> Date: Sat, 25 Feb 2023 19:07:15 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96=E6=97=A0?= =?UTF-8?q?=E6=9D=83=E9=99=90=E8=B7=AF=E7=94=B1=E7=9A=84=E8=BF=87=E6=BB=A4?= =?UTF-8?q?=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