首页 > TAG信息列表 > 祖等

递归寻找子节点的所有父节点(父,爷,祖等)

let retArr: any = []; /** * 递归找ID * @param str * @param arr */ const findPId = (str: any, arr = data as any) => { let curPId = str; for (var idx in arr) { if (arr[idx].id == str) { //返回名字 retArr.push(arr[idx].name); cur