mirror of
https://github.com/wanglin2/mind-map.git
synced 2026-02-21 10:27:44 +08:00
优化代码:修改unexpandAllNode,expandToLevel方法,没有子节点的节点无法收起
This commit is contained in:
parent
d1dcef2537
commit
1a3401fd1a
@ -1230,7 +1230,7 @@ class Render {
|
||||
this.renderTree,
|
||||
null,
|
||||
(node, parent, isRoot) => {
|
||||
if (!isRoot) {
|
||||
if (!isRoot && (node.children && node.children.length > 0)) {
|
||||
node.data.expand = false
|
||||
}
|
||||
},
|
||||
@ -1250,7 +1250,12 @@ class Render {
|
||||
this.renderTree,
|
||||
null,
|
||||
(node, parent, isRoot, layerIndex) => {
|
||||
node.data.expand = layerIndex < level
|
||||
const expand = layerIndex < level
|
||||
if (expand) {
|
||||
node.data.expand = true
|
||||
} else if (!isRoot && (node.children && node.children.length > 0)) {
|
||||
node.data.expand = false
|
||||
}
|
||||
},
|
||||
null,
|
||||
true,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user