Commit b84c8cc4a48220fe779d8676804b0fbe14a81a2d
1 parent
d411992d
增加checkStrictly属性可以取消级联选择
Showing
1 changed file
with
6 additions
and
2 deletions
Show diff stats
src/components/tree/tree.vue
@@ -38,6 +38,10 @@ | @@ -38,6 +38,10 @@ | ||
38 | type: Boolean, | 38 | type: Boolean, |
39 | default: false | 39 | default: false |
40 | }, | 40 | }, |
41 | + checkStrictly:{ | ||
42 | + type:Boolean, | ||
43 | + default:false | ||
44 | + }, | ||
41 | emptyText: { | 45 | emptyText: { |
42 | type: String | 46 | type: String |
43 | }, | 47 | }, |
@@ -103,7 +107,7 @@ | @@ -103,7 +107,7 @@ | ||
103 | }, | 107 | }, |
104 | updateTreeUp(nodeKey){ | 108 | updateTreeUp(nodeKey){ |
105 | const parentKey = this.flatState[nodeKey].parent; | 109 | const parentKey = this.flatState[nodeKey].parent; |
106 | - if (typeof parentKey == 'undefined') return; | 110 | + if (typeof parentKey == 'undefined' || this.checkStrictly) return; |
107 | 111 | ||
108 | const node = this.flatState[nodeKey].node; | 112 | const node = this.flatState[nodeKey].node; |
109 | const parent = this.flatState[parentKey].node; | 113 | const parent = this.flatState[parentKey].node; |
@@ -145,7 +149,7 @@ | @@ -145,7 +149,7 @@ | ||
145 | for (let key in changes) { | 149 | for (let key in changes) { |
146 | this.$set(node, key, changes[key]); | 150 | this.$set(node, key, changes[key]); |
147 | } | 151 | } |
148 | - if (node[this.childrenKey]) { | 152 | + if (node[this.childrenKey] && !this.checkStrictly) { |
149 | node[this.childrenKey].forEach(child => { | 153 | node[this.childrenKey].forEach(child => { |
150 | this.updateTreeDown(child, changes); | 154 | this.updateTreeDown(child, changes); |
151 | }); | 155 | }); |