Commit b84c8cc4a48220fe779d8676804b0fbe14a81a2d

Authored by malin
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 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;
... ... @@ -145,7 +149,7 @@
145 149 for (let key in changes) {
146 150 this.$set(node, key, changes[key]);
147 151 }
148   - if (node[this.childrenKey]) {
  152 + if (node[this.childrenKey] && !this.checkStrictly) {
149 153 node[this.childrenKey].forEach(child => {
150 154 this.updateTreeDown(child, changes);
151 155 });
... ...