Commit 01702799f85ee592c9776ba72f17dfda473be0ce

Authored by Aresn
Committed by GitHub
2 parents 09a536fd 05f490ef

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,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;
@@ -146,6 +150,8 @@ @@ -146,6 +150,8 @@
146 return this.flatState.filter(obj => (obj.node.checked || obj.node.indeterminate)).map(obj => obj.node); 150 return this.flatState.filter(obj => (obj.node.checked || obj.node.indeterminate)).map(obj => obj.node);
147 }, 151 },
148 updateTreeDown(node, changes = {}) { 152 updateTreeDown(node, changes = {}) {
  153 + if (this.checkStrictly) return;
  154 +
149 for (let key in changes) { 155 for (let key in changes) {
150 this.$set(node, key, changes[key]); 156 this.$set(node, key, changes[key]);
151 } 157 }