Feat:节点实例新增getAncestorNodes方法用于获取祖先节点列表

This commit is contained in:
街角小林 2024-03-25 15:38:19 +08:00
parent 8b68b1fc48
commit 3b4195acc5

View File

@ -1047,6 +1047,17 @@ class Node {
return copyNodeTree({}, this, removeActiveState, removeId)
}
// 获取祖先节点列表
getAncestorNodes() {
const list = []
let parent = this.parent
while (parent) {
list.unshift(parent)
parent = parent.parent
}
return list
}
// 是否存在自定义样式
hasCustomStyle() {
return this.style.hasCustomStyle()