正在显示
1 个修改的文件
包含
6 行增加
和
21 行删除
| @@ -82,28 +82,13 @@ function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) { | @@ -82,28 +82,13 @@ function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) { | ||
| 82 | 82 | ||
| 83 | function filterChildren(childrenMap, lastRouter = false) { | 83 | function filterChildren(childrenMap, lastRouter = false) { |
| 84 | var children = [] | 84 | var children = [] |
| 85 | - childrenMap.forEach((el, index) => { | ||
| 86 | - if (el.children && el.children.length) { | ||
| 87 | - if (el.component === 'ParentView' && !lastRouter) { | ||
| 88 | - el.children.forEach(c => { | ||
| 89 | - c.path = el.path + '/' + c.path | ||
| 90 | - if (c.children && c.children.length) { | ||
| 91 | - children = children.concat(filterChildren(c.children, c)) | ||
| 92 | - return | ||
| 93 | - } | ||
| 94 | - children.push(c) | ||
| 95 | - }) | ||
| 96 | - return | ||
| 97 | - } | ||
| 98 | - } | ||
| 99 | - if (lastRouter) { | ||
| 100 | - el.path = lastRouter.path + '/' + el.path | ||
| 101 | - if (el.children && el.children.length) { | ||
| 102 | - children = children.concat(filterChildren(el.children, el)) | ||
| 103 | - return | ||
| 104 | - } | 85 | + childrenMap.forEach(el => { |
| 86 | + el.path = lastRouter ? lastRouter.path + '/' + el.path : el.path | ||
| 87 | + if (el.children && el.children.length && el.component === 'ParentView') { | ||
| 88 | + children = children.concat(filterChildren(el.children, el)) | ||
| 89 | + } else { | ||
| 90 | + children.push(el) | ||
| 105 | } | 91 | } |
| 106 | - children = children.concat(el) | ||
| 107 | }) | 92 | }) |
| 108 | return children | 93 | return children |
| 109 | } | 94 | } |
-
请 注册 或 登录 后发表评论