fix(tree): fix tree node not render in lazy (#1298)

Because `this` pointer is points to origin object in constructor.
This commit is contained in:
Ryan2128 2021-01-18 05:52:18 -06:00 committed by GitHub
parent f9bf392053
commit 63d1b1bc2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View File

@ -41,7 +41,9 @@ export default class TreeStore {
}
this.nodesMap = {}
}
initialize() {
this.root = new Node({
data: this.data,
store: this,

View File

@ -152,6 +152,9 @@ export default defineComponent({
defaultExpandAll: props.defaultExpandAll,
filterNodeMethod: props.filterNodeMethod,
}))
store.value.initialize()
const root = ref<Node>(store.value.root)
const currentNode = ref<Node>(null)
const el$ = ref<Nullable<HTMLElement>>(null)