optimization logic

This commit is contained in:
Pan 2018-09-17 17:44:00 +08:00
parent d6ac227995
commit 225a61770c
1 changed files with 5 additions and 4 deletions

View File

@ -23,11 +23,12 @@ function filterAsyncRouter(routes, roles) {
routes.forEach(route => {
const tmp = { ...route }
if (hasPermission(roles, tmp)) {
if (tmp.children) {
tmp.children = filterAsyncRouter(tmp.children, roles)
}
hasPermission(roles, tmp) && res.push(tmp)
res.push(tmp)
}
})
return res