Commit 01702799f85ee592c9776ba72f17dfda473be0ce
Committed by
GitHub
Merge pull request #4893 from qq240814476/treecheck
Tree add checkStrictly prop
Showing
1 changed file
with
7 additions
and
1 deletions
Show diff stats
src/components/tree/tree.vue
| ... | ... | @@ -38,6 +38,10 @@ |
| 38 | 38 | type: Boolean, |
| 39 | 39 | default: false |
| 40 | 40 | }, |
| 41 | + checkStrictly:{ | |
| 42 | + type:Boolean, | |
| 43 | + default:false | |
| 44 | + }, | |
| 41 | 45 | emptyText: { |
| 42 | 46 | type: String |
| 43 | 47 | }, |
| ... | ... | @@ -103,7 +107,7 @@ |
| 103 | 107 | }, |
| 104 | 108 | updateTreeUp(nodeKey){ |
| 105 | 109 | const parentKey = this.flatState[nodeKey].parent; |
| 106 | - if (typeof parentKey == 'undefined') return; | |
| 110 | + if (typeof parentKey == 'undefined' || this.checkStrictly) return; | |
| 107 | 111 | |
| 108 | 112 | const node = this.flatState[nodeKey].node; |
| 109 | 113 | const parent = this.flatState[parentKey].node; |
| ... | ... | @@ -146,6 +150,8 @@ |
| 146 | 150 | return this.flatState.filter(obj => (obj.node.checked || obj.node.indeterminate)).map(obj => obj.node); |
| 147 | 151 | }, |
| 148 | 152 | updateTreeDown(node, changes = {}) { |
| 153 | + if (this.checkStrictly) return; | |
| 154 | + | |
| 149 | 155 | for (let key in changes) { |
| 150 | 156 | this.$set(node, key, changes[key]); |
| 151 | 157 | } | ... | ... |