nodes是树结构数据,id是要查找的树节点的id
const node = this.getNode(nodes, this.id); console.log(node); getNode(treeNodes: Array<any>, key) { let node; for (const treeNode of treeNodes) { if (treeNode.Id === key) { node = treeNode; break; } if (!Util.IsNullOrEmpty(treeNode.Children)) { node = this.getNode(treeNode.Children, key); if (node) { break; } } } return node; }