fix(tree): fix tree node don't update after push new node into parent (#1231)

Co-authored-by: bastarder <jie.qian@blockheaders.com>
This commit is contained in:
bastarder 2021-01-11 10:32:49 +08:00 committed by GitHub
parent 513908a829
commit 1efee81cf3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -133,7 +133,10 @@ export default defineComponent({
}
const childrenKey = tree.props['children'] || 'children'
watch(() => props.node.data[childrenKey], () => {
watch(() => {
const children = props.node.data[childrenKey]
return children && [...children]
}, () => {
props.node.updateChildren()
})