Keep original data pointers and correct if clause

This commit is contained in:
Sergio Crisostomo 2017-10-24 09:30:09 +02:00
parent d44420be72
commit 0a8f9b43f6

View file

@ -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) {