From 0a8f9b43f6497c8dc0376e738b314304f12ed770 Mon Sep 17 00:00:00 2001 From: Sergio Crisostomo Date: Tue, 24 Oct 2017 09:30:09 +0200 Subject: [PATCH] Keep original data pointers and correct if clause --- src/components/tree/tree.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/tree/tree.vue b/src/components/tree/tree.vue index eee3f305..4395da3c 100644 --- a/src/components/tree/tree.vue +++ b/src/components/tree/tree.vue @@ -44,13 +44,13 @@ data () { return { prefixCls: prefixCls, - stateTree: JSON.parse(JSON.stringify(this.data)), + stateTree: this.data, flatState: [], }; }, watch: { data(){ - this.stateTree = JSON.parse(JSON.stringify(this.data)); + this.stateTree = this.data; this.flatState = this.compileFlatState(); this.rebuildTree(); } @@ -109,7 +109,7 @@ this.updateTreeDown(node, {checked: true}); // propagate upwards const parentKey = this.flatState[node.nodeKey].parent; - if (!parentKey) return; + if (!parentKey && parentKey !== 0) return; const parent = this.flatState[parentKey].node; const childHasCheckSetter = typeof node.checked != 'undefined' && node.checked; if (childHasCheckSetter && parent.checked != node.checked) {