From b84c8cc4a48220fe779d8676804b0fbe14a81a2d Mon Sep 17 00:00:00 2001 From: malin Date: Fri, 23 Nov 2018 16:17:02 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0checkStrictly=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E5=8F=AF=E4=BB=A5=E5=8F=96=E6=B6=88=E7=BA=A7=E8=81=94?= =?UTF-8?q?=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/tree/tree.vue | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/tree/tree.vue b/src/components/tree/tree.vue index fd4f9545..6d5aeb76 100644 --- a/src/components/tree/tree.vue +++ b/src/components/tree/tree.vue @@ -38,6 +38,10 @@ type: Boolean, default: false }, + checkStrictly:{ + type:Boolean, + default:false + }, emptyText: { type: String }, @@ -103,7 +107,7 @@ }, updateTreeUp(nodeKey){ const parentKey = this.flatState[nodeKey].parent; - if (typeof parentKey == 'undefined') return; + if (typeof parentKey == 'undefined' || this.checkStrictly) return; const node = this.flatState[nodeKey].node; const parent = this.flatState[parentKey].node; @@ -145,7 +149,7 @@ for (let key in changes) { this.$set(node, key, changes[key]); } - if (node[this.childrenKey]) { + if (node[this.childrenKey] && !this.checkStrictly) { node[this.childrenKey].forEach(child => { this.updateTreeDown(child, changes); }); From 05f490efdcb5679ebaa7e6541226c44c370171b6 Mon Sep 17 00:00:00 2001 From: Aresn Date: Mon, 17 Dec 2018 10:31:23 +0800 Subject: [PATCH 2/2] Update tree.vue --- src/components/tree/tree.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/tree/tree.vue b/src/components/tree/tree.vue index 6d5aeb76..df4a60d4 100644 --- a/src/components/tree/tree.vue +++ b/src/components/tree/tree.vue @@ -146,10 +146,12 @@ return this.flatState.filter(obj => obj.node.checked).map(obj => obj.node); }, updateTreeDown(node, changes = {}) { + if (this.checkStrictly) return; + for (let key in changes) { this.$set(node, key, changes[key]); } - if (node[this.childrenKey] && !this.checkStrictly) { + if (node[this.childrenKey]) { node[this.childrenKey].forEach(child => { this.updateTreeDown(child, changes); });