将最后一级children 递归 置为 undefined
// 获取数据
commonApi.officeTree().then(resp => {
if (resp.status === 'SUCCEED') {
let data = resp.result;
this.getTypeList(data);
this.conpanyOptions = data;
}
})
// 递归遍历
getTypeList(commodityType) {
commodityType.forEach(items => {
if (items.children.length > 0) {
this.getTypeList(items.children);
} else {
items.children = undefined;
}
});
},