diff --git a/examples/routers/tree.vue b/examples/routers/tree.vue index ead7331c..79300dfe 100644 --- a/examples/routers/tree.vue +++ b/examples/routers/tree.vue @@ -1,81 +1,55 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/components/tree/tree.vue b/src/components/tree/tree.vue index 9ee99fda..ac942ea9 100644 --- a/src/components/tree/tree.vue +++ b/src/components/tree/tree.vue @@ -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);