mirror of
https://gitee.com/fantastic-admin/basic.git
synced 2024-12-02 12:07:41 +08:00
refactor: 优化无权限路由的过滤函数
This commit is contained in:
parent
3eb65f6da4
commit
f3cc0b0ecb
@ -176,14 +176,14 @@ const useRouteStore = defineStore(
|
|||||||
const res: any = []
|
const res: any = []
|
||||||
routes.forEach((route) => {
|
routes.forEach((route) => {
|
||||||
const tmpRoute = cloneDeep(route)
|
const tmpRoute = cloneDeep(route)
|
||||||
if (tmpRoute.children) {
|
if (hasPermission(permissions, route)) {
|
||||||
tmpRoute.children = filterAsyncRoutesNoAuth(tmpRoute.children, permissions)
|
if (tmpRoute.children) {
|
||||||
tmpRoute.children.length && res.push(tmpRoute)
|
tmpRoute.children = filterAsyncRoutesNoAuth(tmpRoute.children, permissions)
|
||||||
|
tmpRoute.children.length && res.push(tmpRoute)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!hasPermission(permissions, route)) {
|
res.push(tmpRoute)
|
||||||
res.push(tmpRoute)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return res
|
return res
|
||||||
|
Loading…
Reference in New Issue
Block a user