|
|
@ -33,10 +33,11 @@ export default { |
|
|
|
components: { SidebarItem, Logo }, |
|
|
|
components: { SidebarItem, Logo }, |
|
|
|
created: function () { |
|
|
|
created: function () { |
|
|
|
this.getmunusdata(); |
|
|
|
this.getmunusdata(); |
|
|
|
|
|
|
|
this.menusdatas = 66 |
|
|
|
}, |
|
|
|
}, |
|
|
|
data() { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
return { |
|
|
|
routes:menusdata |
|
|
|
//routes:this.menusdatas |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
computed: { |
|
|
@ -67,43 +68,44 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
SplicingMenuTree(menus, menusdatas) { |
|
|
|
SplicingMenuTree(menus) { |
|
|
|
// console.log(menus); |
|
|
|
let newMenu = null, arrMenus = []; |
|
|
|
// console.log(menusdatas); |
|
|
|
|
|
|
|
// console.log(this.routes[0]); |
|
|
|
|
|
|
|
menus.forEach(item => { |
|
|
|
menus.forEach(item => { |
|
|
|
//console.log(menusdata[0]); |
|
|
|
//console.log(menusdata[0]); |
|
|
|
if (!menusdatas.children) { |
|
|
|
// if (!this.menusdata.children) { |
|
|
|
this.$set(menusdatas,'children', []) |
|
|
|
// this.$set(this.menusdata,'children', []) |
|
|
|
//menusdata[0].children = [] |
|
|
|
// //menusdata[0].children = [] |
|
|
|
} |
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
//Object.assign(menusdata[0],) |
|
|
|
newMenu = { |
|
|
|
menusdatas.children.push( |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
path: '/subfile?id='+item.id, |
|
|
|
path: '/subfile?id='+item.id, |
|
|
|
meta: { title: item.directory, icon: 'dashboard' } |
|
|
|
meta: { title: item.directory, icon: 'dashboard' }, |
|
|
|
|
|
|
|
children:[] |
|
|
|
} |
|
|
|
} |
|
|
|
); |
|
|
|
|
|
|
|
//console.log(item.directories.length); |
|
|
|
//console.log(item.directories.length); |
|
|
|
if (item.directories && item.directories.length > 0) { |
|
|
|
if (item.directories && item.directories.length > 0) { |
|
|
|
this.SplicingMenuTree(item.directories, menusdatas.children[item.directories.length-1]) |
|
|
|
newMenu.children = this.SplicingMenuTree(item.directories,) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
arrMenus.push(newMenu); |
|
|
|
|
|
|
|
console.log(arrMenus); |
|
|
|
|
|
|
|
return arrMenus; |
|
|
|
}); |
|
|
|
}); |
|
|
|
console.log(menusdata[0].children); |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
getmunusdata() { |
|
|
|
getmunusdata() { |
|
|
|
let thiss = this; |
|
|
|
let thiss = this; |
|
|
|
console.log(this.$route); |
|
|
|
// console.log(this.$route); |
|
|
|
console.log(this.$store); |
|
|
|
// console.log(this.$store); |
|
|
|
|
|
|
|
|
|
|
|
mirlist().then(response => { |
|
|
|
mirlist().then(response => { |
|
|
|
let datamain = response.data; |
|
|
|
let datamain = response.data; |
|
|
|
//routesData(datamain.data.menus); |
|
|
|
//routesData(datamain.data.menus); |
|
|
|
//console.log(response); |
|
|
|
//console.log(response); |
|
|
|
|
|
|
|
console.log(this.menusdatas); |
|
|
|
this.SplicingMenuTree(datamain.data.menus, menusdata[0]); |
|
|
|
this.menusdatas = this.SplicingMenuTree(datamain.data.menus); |
|
|
|
|
|
|
|
console.log(this.menusdatas); |
|
|
|
//this.routes = menusdata |
|
|
|
//this.routes = menusdata |
|
|
|
//console.log(menusdata); |
|
|
|
//console.log(menusdata); |
|
|
|
|
|
|
|
|
|
|
|