This commit is contained in:
mo.duan 2019-10-09 16:41:00 +08:00
parent a6068736cb
commit b93725bbb9
2 changed files with 51 additions and 71 deletions

View file

@ -121,9 +121,9 @@
const node = this.flatState[nodeKey].node;
const parent = this.flatState[parentKey].node;
if (node.checked == parent.checked && node.indeterminate == parent.indeterminate) return; // no need to update upwards
if (node.checked == true) {
this.$set(parent, 'checked', parent[this.childrenKey].every(node => node.checked));
// #6121
this.$set(parent, 'checked', parent[this.childrenKey].every(node => node.checked || node.disabled !== undefined ));
this.$set(parent, 'indeterminate', !parent.checked);
} else {
this.$set(parent, 'checked', false);
@ -160,10 +160,16 @@
},
updateTreeDown(node, changes = {}) {
if (this.checkStrictly) return;
for (let key in changes) {
this.$set(node, key, changes[key]);
// after #6121
if( key === 'checked' && node.disabled ){
this.$set(node, key, node.checked);
}else{
this.$set(node, key, changes[key]);
}
// before -- this.$set(node, key, changes[key]);
}
if (node[this.childrenKey]) {
node[this.childrenKey].forEach(child => {
this.updateTreeDown(child, changes);