当我点击节点时,有谁知道我如何获得完整的路径。 我在API中看到了一个路径选项,但我并不确切知道如何在点击事件中使用它。
options: ITreeOptions = {
actionMapping: {
mouse: {
dblClick: (tree, node, $event) => {
}
}
}
}
答案 0 :(得分:1)
根据您需要的格式,您可以自己构建血统/路径
options: ITreeOptions = {
actionMapping: {
mouse: {
dblClick: (tree, node, $event) => {
const lineage = [];
// add clicked node as first item
lineage.push(node.data);
// grab parent of clicked node
let parent = node.parent;
// loop through parents until the root of the tree is reached
while(parent !== null){
lineage.push(parent.data);
parent = parent.parent;
}
}
}
}
}