angular-树组件 |获取路径

angular-tree-component | get Path

有谁知道我在单击节点时如何获得完整路径。 我在 API 中看到了一个路径选项,但我不知道如何将它与点击事件一起使用。

options: ITreeOptions = {
 actionMapping: {
  mouse: {
    dblClick: (tree, node, $event) => {

    }
  }
 }
}

根据您需要的格式,您可以自己构建 lineage/path

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;
                }
            }
        }
    }
}