Skip to content

Commit 6a08869

Browse files
authored
Merge pull request #5 from qishibo/patch-1
checkAll support
2 parents 7b297b8 + 63974a9 commit 6a08869

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/components/model/tree-store.js

+9
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,15 @@ export default class TreeStore {
327327
}
328328
}
329329

330+
setCheckedAll(checked = true) {
331+
const allNodes = this._getAllNodes();
332+
333+
for (const node of allNodes) {
334+
node.indeterminate = false;
335+
node.checked = checked;
336+
}
337+
}
338+
330339
getCurrentNode() {
331340
return this.currentNode;
332341
}

src/components/ve-tree.vue

+5-1
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,10 @@ export default {
308308
this.store.setChecked(data, checked, deep);
309309
},
310310
311+
setCheckedAll(checked = true) {
312+
this.store.setCheckedAll(checked);
313+
},
314+
311315
getHalfCheckedNodes() {
312316
return this.store.getHalfCheckedNodes();
313317
},
@@ -633,4 +637,4 @@ export default {
633637
this.checkboxItems = this.$el.querySelectorAll("input[type=checkbox]");
634638
}
635639
};
636-
</script>
640+
</script>

0 commit comments

Comments
 (0)