过滤后的节点数组
const treeDataArr = [
{key: '1',children: [{key: '1-1'},{key: '1-2',children: [{key: '1-2-1',},{key: '1-2-2'}]}]},
{key: '2',children: [{key: '2-1',children: [{key: '2-1-1'}]}]}
]
filterTreeArray(treeDataArr, (node) => {
return node.key === '1-2-1'
})
输出:
[{key: '1',children: [{key: '1-2',children: [{key: '1-2-1'}]}]}]
递归过滤树形结构数据