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