//递归重组tree数据 concatTreeData(list,newData, keyId,isLayze) { let isFlag = false; list.map((item, index) => { if (item.id == keyId) { if (item.children) { item.children = [...item.children, ...newData] } else { item.children = newData; } isFlag = true; } else { if (!isFlag) { if (item.children) { this.concatTreeData(item.children,newData, keyId) } } } return item }) this.treeDataList = list },
标签:keyId,递归,树结构,isFlag,list,children,js,item,newData From: https://www.cnblogs.com/iwen1992/p/17545459.html