优化代码:修改unexpandAllNode,expandToLevel方法,没有子节点的节点无法收起
This commit is contained in:
parent
d1dcef2537
commit
1a3401fd1a
@ -1230,7 +1230,7 @@ class Render {
|
|||||||
this.renderTree,
|
this.renderTree,
|
||||||
null,
|
null,
|
||||||
(node, parent, isRoot) => {
|
(node, parent, isRoot) => {
|
||||||
if (!isRoot) {
|
if (!isRoot && (node.children && node.children.length > 0)) {
|
||||||
node.data.expand = false
|
node.data.expand = false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -1250,7 +1250,12 @@ class Render {
|
|||||||
this.renderTree,
|
this.renderTree,
|
||||||
null,
|
null,
|
||||||
(node, parent, isRoot, layerIndex) => {
|
(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,
|
null,
|
||||||
true,
|
true,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user