Skip to content

Commit

Permalink
Keep original data pointers and correct if clause
Browse files Browse the repository at this point in the history
  • Loading branch information
SergioCrisostomo committed Oct 24, 2017
1 parent d44420b commit 0a8f9b4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/tree/tree.vue
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 0a8f9b4

Please sign in to comment.