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 => { 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