function deepQuery(tree:any,id:any){ let isGet = false; let retNode = {title:''}; function deepSearch(tree:any,id:any){ for(var i = 0;i<tree.length;i++){ if(tree[i].children && tree[i].children.length > 0){ deepSearch(tree[i].children,id); } if(id === tree[i].id || isGet){ isGet || (retNode = tree[i]); isGet = true; break; } } }
deepSearch(tree,id);
return retNode;
}