fix: sync cacheExpandedKeys when passing loadData func

This commit is contained in:
gx-mac 2021-03-10 16:42:04 +08:00
parent ac4e3f29e1
commit 3f7f4c4237
1 changed files with 2 additions and 3 deletions

View File

@ -345,7 +345,8 @@ onExpand(treeNode,keyType) {
node: treeNode,
expanded
});
//收起和展开时,缓存 expandedKeys
this.cacheExpandedKeys = new Set(expandedKeys);
// after data loaded, need set new expandedKeys
if (expanded && this.props.loadData) {
return this.props.loadData(treeNode).then(() => {
@ -356,8 +357,6 @@ onExpand(treeNode,keyType) {
}
});
}
//收起和展开时,缓存 expandedKeys
this.cacheExpandedKeys = new Set(expandedKeys);
//启用懒加载,把 Tree 结构拍平,为后续动态截取数据做准备
if(lazyLoad) {
let flatTreeData = this.deepTraversal(treeData);