Commit 0a8f9b43f6497c8dc0376e738b314304f12ed770

Authored by Sergio Crisostomo
1 parent d44420be

Keep original data pointers and correct if clause

Showing 1 changed file with 3 additions and 3 deletions   Show diff stats
src/components/tree/tree.vue
... ... @@ -44,13 +44,13 @@
44 44 data () {
45 45 return {
46 46 prefixCls: prefixCls,
47   - stateTree: JSON.parse(JSON.stringify(this.data)),
  47 + stateTree: this.data,
48 48 flatState: [],
49 49 };
50 50 },
51 51 watch: {
52 52 data(){
53   - this.stateTree = JSON.parse(JSON.stringify(this.data));
  53 + this.stateTree = this.data;
54 54 this.flatState = this.compileFlatState();
55 55 this.rebuildTree();
56 56 }
... ... @@ -109,7 +109,7 @@
109 109 this.updateTreeDown(node, {checked: true});
110 110 // propagate upwards
111 111 const parentKey = this.flatState[node.nodeKey].parent;
112   - if (!parentKey) return;
  112 + if (!parentKey && parentKey !== 0) return;
113 113 const parent = this.flatState[parentKey].node;
114 114 const childHasCheckSetter = typeof node.checked != 'undefined' && node.checked;
115 115 if (childHasCheckSetter && parent.checked != node.checked) {
... ...