Skip to content

Commit

Permalink
Merge pull request Tencent#103 from Godlike-meteor/develop
Browse files Browse the repository at this point in the history
fix(tree-select): fix data lazy load bug
  • Loading branch information
chaishi committed Dec 26, 2021
2 parents 5e014f8 + 297917e commit ffc6e45
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/tree-select/tree-select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export default mixins(getConfigReceiverMixins<Vue, TreeSelectConfig>('treeSelect
actived: [],
expanded: [],
nodeInfo: null,
treeKey: 0,
};
},
watch: {
Expand All @@ -60,6 +61,10 @@ export default mixins(getConfigReceiverMixins<Vue, TreeSelectConfig>('treeSelect
this.actived = this.nodeInfo ? [this.nodeInfo.value] : [];
}
},
async data() {
await this.changeNodeInfo();
this.treeRerender();
},
},
computed: {
classes(): ClassName {
Expand Down Expand Up @@ -340,16 +345,20 @@ export default mixins(getConfigReceiverMixins<Vue, TreeSelectConfig>('treeSelect
this.nodeInfo = null;
}
},
treeRerender() {
this.treeKey += 1;
},
},
render(): VNode {
const {
treeProps, popupObject, classes, popupClass,
treeProps, popupObject, classes, popupClass, treeKey,
} = this;
const iconStyle = { 'font-size': this.size };
const treeItem = (
<Tree
ref="tree"
v-show={this.showTree}
key={treeKey}
value={this.checked}
hover
data={this.data}
Expand Down

0 comments on commit ffc6e45

Please sign in to comment.