|
|
|
@ -57,13 +57,12 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
addParentId(tree, parentPath) {
|
|
|
|
|
tree.forEach((node) => {
|
|
|
|
|
// node.parentPath = node.path + parentPath; // 将父级的 id 添加为属性
|
|
|
|
|
let merge = parentPath
|
|
|
|
|
? this.filterPath(parentPath) + this.filterPath(node.path)
|
|
|
|
|
: this.filterPath(node.path);
|
|
|
|
|
node.fullPath = merge;
|
|
|
|
|
if (node.children && node.children.length > 0) {
|
|
|
|
|
this.addParentId(node.children, node.fullPath); // 递归调用,传递当前节点的 id 作为父级 id
|
|
|
|
|
this.addParentId(node.children, node.fullPath);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return tree;
|
|
|
|
|