// 递归遍历数据获取当前实体名称
recursionChildren(arr, node) {
let name = "";
arr.forEach((item) => {
let temp = { ...item };
if (temp.children && temp.children.length > 0) {
if (temp.id == node) {
name = temp.label;
} else {
let result = this.recursionChildren(temp.children, node);
if (result) {
name = result;
}
}
} else {
if (temp.id == node) {
name = temp.label;
}
}
});
return name;
},
js chamada recursiva e multicamada se mais aninhamento, valor de retorno estiver vazio ou problema indefinido
Supongo que te gusta
Origin blog.csdn.net/song_song0927/article/details/132237592
Recomendado
Clasificación