created() {this.addLevel(this.treeData); // 数组
}
methods:{addLevel (array, i = 1) {let tableList = (arr, i) => {
arr.forEach(item => {
item.level = i;
if (item.children && item.children.length) {return this.addLevel(item.children, i + 1);
}
});
};
return tableList(array, i);
},
}