|
@@ -48,21 +48,42 @@ const mutations = {
|
|
// 递归遍历数组
|
|
// 递归遍历数组
|
|
function recursionRouter (arr) {
|
|
function recursionRouter (arr) {
|
|
if (arr.length > 0) {
|
|
if (arr.length > 0) {
|
|
- let newArr = arr.map(item => {
|
|
|
|
|
|
+ let newArr = [];
|
|
|
|
+ for (let i = 0; i < arr.length; i++) {
|
|
|
|
+ if (arr[i].type == 1) {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
let obj = {};
|
|
let obj = {};
|
|
- obj.component = item.component;
|
|
|
|
- // if (item.type != '1' && item.component != 'Layout') {
|
|
|
|
- // console.log(item)
|
|
|
|
- // obj.name = item.name
|
|
|
|
|
|
+ obj.component = arr[i].component;
|
|
|
|
+ // if (item.type != '1' && item.component) {
|
|
|
|
+ // if (!item.path.startsWith('/') && item.component != 'Layout') {
|
|
|
|
+ // obj.names = item.name
|
|
|
|
+ // }
|
|
// }
|
|
// }
|
|
- item.hid == 0 ? obj.hidden = false : obj.hidden = true
|
|
|
|
- obj.path = item.path;
|
|
|
|
- obj.meta = { 'title': item.name, 'icon': item.icon }
|
|
|
|
- if (item.sysMenus && item.sysMenus.length > 0) {
|
|
|
|
- obj.children = recursionRouter(item.sysMenus);
|
|
|
|
|
|
+ arr[i].hid == 0 ? obj.hidden = false : obj.hidden = true
|
|
|
|
+ obj.path = arr[i].path;
|
|
|
|
+ obj.meta = { 'title': arr[i].name, 'icon': arr[i].icon }
|
|
|
|
+ if (arr[i].sysMenus && arr[i].sysMenus.length > 0) {
|
|
|
|
+ obj.children = recursionRouter(arr[i].sysMenus);
|
|
}
|
|
}
|
|
- return obj
|
|
|
|
- })
|
|
|
|
|
|
+ newArr.push(obj)
|
|
|
|
+ }
|
|
|
|
+ // newArr = arr.map(item => {
|
|
|
|
+ // let obj = {};
|
|
|
|
+ // obj.component = item.component;
|
|
|
|
+ // // if (item.type != '1' && item.component) {
|
|
|
|
+ // // if (!item.path.startsWith('/') && item.component != 'Layout') {
|
|
|
|
+ // // obj.names = item.name
|
|
|
|
+ // // }
|
|
|
|
+ // // }
|
|
|
|
+ // item.hid == 0 ? obj.hidden = false : obj.hidden = true
|
|
|
|
+ // obj.path = item.path;
|
|
|
|
+ // obj.meta = { 'title': item.name, 'icon': item.icon }
|
|
|
|
+ // if (item.sysMenus && item.sysMenus.length > 0) {
|
|
|
|
+ // obj.children = recursionRouter(item.sysMenus);
|
|
|
|
+ // }
|
|
|
|
+ // return obj
|
|
|
|
+ // })
|
|
return newArr
|
|
return newArr
|
|
}
|
|
}
|
|
}
|
|
}
|