修复子菜单为空时菜单名称前面仍然显示加号

pull/22/head
tomaito 2021-05-09 11:44:38 +08:00 committed by Gitee
parent 91a4f66838
commit 2b3fb88b3c
1 changed files with 15 additions and 1 deletions

View File

@ -31,7 +31,7 @@
</span>
<span slot="icon" slot-scope="text">
<div v-if="text != ''">
<div v-if="text != null && text != ''">
<a-icon :type="text"/>
</div>
</span>
@ -88,6 +88,7 @@
{
title: '组件',
dataIndex: 'component',
width: '20%',
ellipsis: true
},
{
@ -124,6 +125,7 @@
getMenuList(this.queryParam).then((res) => {
if (res.success) {
this.data = res.data
this.removeEmptyChildren(this.data)
}
}).finally(() => {
this.loading = false
@ -131,6 +133,18 @@
this.sysDictTypeDropDown()
},
removeEmptyChildren(data) {
if (data == null || data.length === 0) return
for (let i = 0; i < data.length; i++) {
const item = data[i]
if (item.children != null && item.children.length === 0) {
item.children = null
} else {
this.removeEmptyChildren(item.children)
}
}
},
typeFilter (type) {
// eslint-disable-next-line eqeqeq
const values = this.typeDict.filter(item => item.code == type)