optimization logic

This commit is contained in:
Pan
2018-09-17 17:44:00 +08:00
parent d6ac227995
commit 225a61770c

View File

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