From 2d704cdcebd715c154a75d40fe938009c46daef1 Mon Sep 17 00:00:00 2001 From: richard1015 <51844712@qq.com> Date: Mon, 23 Dec 2019 09:59:13 +0800 Subject: [PATCH 01/21] =?UTF-8?q?feat=EF=BC=9ACheckboxGroup=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=85=A8=E9=80=89=E3=80=81=E5=8F=8D=E9=80=89=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/packages/checkboxgroup/checkboxgroup.vue | 29 +++++++++++++++++++- src/packages/checkboxgroup/demo.vue | 9 ++++-- src/packages/checkboxgroup/doc.md | 24 ++++++++++++++-- 3 files changed, 56 insertions(+), 6 deletions(-) diff --git a/src/packages/checkboxgroup/checkboxgroup.vue b/src/packages/checkboxgroup/checkboxgroup.vue index ca3d95e9d5..58108f1752 100644 --- a/src/packages/checkboxgroup/checkboxgroup.vue +++ b/src/packages/checkboxgroup/checkboxgroup.vue @@ -148,7 +148,34 @@ export default { }, - + toggleAll(checked) { + if (checked === false) { + this.$emit("input", []); + return; + } + if(checked === true){ + this.checkBoxData.map(item => { + item.checked = true; + }); + } + if (!checked) { + this.checkBoxData.map(item => { + item.checked = !item.checked; + }); + } + + let value = [], + label = []; + let resData = this.checkBoxData.filter(item => { + if (item.checked) { + value.push(item.value); + label.push(item.label); + } + return item.checked; + }); + this.$emit("input",value); + this.$emit("change", value, label, null); + } } } \ No newline at end of file diff --git a/src/packages/checkboxgroup/demo.vue b/src/packages/checkboxgroup/demo.vue index b99a479d9e..9bf0c3524e 100644 --- a/src/packages/checkboxgroup/demo.vue +++ b/src/packages/checkboxgroup/demo.vue @@ -3,9 +3,12 @@
{{group1}}
+{{group1}}
+