mirror of
https://github.com/wanglin2/mind-map.git
synced 2026-02-21 10:27:44 +08:00
Feat:给节点实例增加isParent方法
This commit is contained in:
parent
d32588763c
commit
cadd159a46
@ -917,6 +917,18 @@ class Node {
|
||||
return false
|
||||
}
|
||||
|
||||
// 检查当前节点是否是某个节点的父节点
|
||||
isParent(node) {
|
||||
if (this.uid === node.uid) {
|
||||
return false
|
||||
}
|
||||
const parent = node.parent
|
||||
if (parent && this.uid === parent.uid) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// 检测当前节点是否是某个节点的兄弟节点
|
||||
isBrother(node) {
|
||||
if (!this.parent || this.uid === node.uid) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user