From 63d1b1bc2e96817f807ec86210a18a8ad931b8ce Mon Sep 17 00:00:00 2001 From: Ryan2128 <33176053+Ryan2128@users.noreply.github.com> Date: Mon, 18 Jan 2021 05:52:18 -0600 Subject: [PATCH] fix(tree): fix tree node not render in lazy (#1298) Because `this` pointer is points to origin object in constructor. --- packages/tree/src/model/tree-store.ts | 2 ++ packages/tree/src/tree.vue | 3 +++ 2 files changed, 5 insertions(+) diff --git a/packages/tree/src/model/tree-store.ts b/packages/tree/src/model/tree-store.ts index 72241b216a..2acea47bbe 100644 --- a/packages/tree/src/model/tree-store.ts +++ b/packages/tree/src/model/tree-store.ts @@ -41,7 +41,9 @@ export default class TreeStore { } this.nodesMap = {} + } + initialize() { this.root = new Node({ data: this.data, store: this, diff --git a/packages/tree/src/tree.vue b/packages/tree/src/tree.vue index 642406c9fe..cb744b3142 100644 --- a/packages/tree/src/tree.vue +++ b/packages/tree/src/tree.vue @@ -152,6 +152,9 @@ export default defineComponent({ defaultExpandAll: props.defaultExpandAll, filterNodeMethod: props.filterNodeMethod, })) + + store.value.initialize() + const root = ref(store.value.root) const currentNode = ref(null) const el$ = ref>(null)