|
@@ -82,28 +82,13 @@ function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) {
|
|
|
|
|
|
function filterChildren(childrenMap, lastRouter = false) {
|
|
function filterChildren(childrenMap, lastRouter = false) {
|
|
var children = []
|
|
var children = []
|
|
- childrenMap.forEach((el, index) => {
|
|
|
|
- if (el.children && el.children.length) {
|
|
|
|
- if (el.component === 'ParentView' && !lastRouter) {
|
|
|
|
- el.children.forEach(c => {
|
|
|
|
- c.path = el.path + '/' + c.path
|
|
|
|
- if (c.children && c.children.length) {
|
|
|
|
- children = children.concat(filterChildren(c.children, c))
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- children.push(c)
|
|
|
|
- })
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (lastRouter) {
|
|
|
|
- el.path = lastRouter.path + '/' + el.path
|
|
|
|
- if (el.children && el.children.length) {
|
|
|
|
- children = children.concat(filterChildren(el.children, el))
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
|
|
+ childrenMap.forEach(el => {
|
|
|
|
+ el.path = lastRouter ? lastRouter.path + '/' + el.path : el.path
|
|
|
|
+ if (el.children && el.children.length && el.component === 'ParentView') {
|
|
|
|
+ children = children.concat(filterChildren(el.children, el))
|
|
|
|
+ } else {
|
|
|
|
+ children.push(el)
|
|
}
|
|
}
|
|
- children = children.concat(el)
|
|
|
|
})
|
|
})
|
|
return children
|
|
return children
|
|
}
|
|
}
|