update: menu relation transformation completed

This commit is contained in:
QM303176530
2020-04-05 20:14:15 +08:00
parent c755120c8d
commit 81a54b5a44
11 changed files with 110 additions and 116 deletions
+1 -1
View File
@@ -22,7 +22,7 @@
<el-dropdown>
<span class="el-dropdown-link">
<img :src="userInfo.headerImg" height="30" width="30" />
{{userInfo.nickName}}
{{userInfo.title}}
<i class="el-icon-arrow-down"></i>
</span>
<el-dropdown-menu class="dropdown-group" slot="dropdown">
@@ -44,10 +44,10 @@ export default {
const apiObj = new Object()
apis &&
apis.map(item => {
if (apiObj.hasOwnProperty(item.group)) {
apiObj[item.group].push(item)
if (apiObj.hasOwnProperty(item.apiGroup)) {
apiObj[item.apiGroup].push(item)
} else {
Object.assign(apiObj, { [item.group]: [item] })
Object.assign(apiObj, { [item.apiGroup]: [item] })
}
})
const apiTree = []
@@ -34,7 +34,9 @@ export default {
menuTreeIds: [],
menuDefaultProps: {
children: 'children',
label: 'nickName'
label: function(data){
return data.meta.title
}
}
}
},
@@ -64,8 +66,8 @@ export default {
const arr = []
menus.map(item => {
// 防止直接选中父级造成全选
if (!menus.some(same => same.parentId === item.menuId)) {
arr.push(Number(item.menuId))
if (!menus.some(same => same.parentId === item.ID)) {
arr.push(Number(item.ID))
}
})
this.menuTreeIds = arr