从树状列表中,查询到指定id的节点并返回
从树状列表中,查询到指定id的节点并返回:
getTreeItem(data, code){
let result
let hasFound = false
const fn = function(data, code){
for(let i=0; i < data.length; i++){
if(data[i].code === code && !hasFound){
result = data[i].name
hasFound = true
}else if(data[i].children && data[i].children.length > 0){
this.fn(data[i].children, code)
}
}
}
fn(data, code)
return result
}

浙公网安备 33010602011771号