optimization logic
This commit is contained in:
parent
d6ac227995
commit
225a61770c
|
@ -23,11 +23,12 @@ function filterAsyncRouter(routes, roles) {
|
||||||
|
|
||||||
routes.forEach(route => {
|
routes.forEach(route => {
|
||||||
const tmp = { ...route }
|
const tmp = { ...route }
|
||||||
if (tmp.children) {
|
if (hasPermission(roles, tmp)) {
|
||||||
tmp.children = filterAsyncRouter(tmp.children, roles)
|
if (tmp.children) {
|
||||||
|
tmp.children = filterAsyncRouter(tmp.children, roles)
|
||||||
|
}
|
||||||
|
res.push(tmp)
|
||||||
}
|
}
|
||||||
|
|
||||||
hasPermission(roles, tmp) && res.push(tmp)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
return res
|
return res
|
||||||
|
|
Loading…
Reference in New Issue