js遍历树形结构并返回所有的子节点id值
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是树形结构