lookForAllId(data = [], arr = []) {
for (let item of data) {
arr.push(item.id);
if (item.children && item.children.length)
this.lookForAllId(item.children, arr);
}
return arr;
},
//调用
this.lookForAllId(this.treeArry) //treeArry是树形结构
微信扫一扫
lookForAllId(data = [], arr = []) {
for (let item of data) {
arr.push(item.id);
if (item.children && item.children.length)
this.lookForAllId(item.children, arr);
}
return arr;
},
//调用
this.lookForAllId(this.treeArry) //treeArry是树形结构
相关推荐