From bd3c69b5d96767da0af25ccd0364ad39bb52d617 Mon Sep 17 00:00:00 2001 From: msidolphin Date: Wed, 30 May 2018 23:31:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dtable=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=85=A8=E9=80=89bug=EF=BC=8C=E4=BF=AE=E5=A4=8D=E5=A4=8D?= =?UTF-8?q?=E9=80=89=E6=A1=86=E6=9C=AA=E9=85=8D=E7=BD=AEchecked=E6=97=B6?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E9=80=89=E6=8B=A9=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/views/basic/table.vue | 18 +++++++--------- docs/views/form/checkbox.vue | 33 +++++++++++++++++++++------- src/components/basic/table.vue | 37 ++++++++++++++++++-------------- src/components/form/checkbox.vue | 15 +++++++------ 4 files changed, 63 insertions(+), 40 deletions(-) diff --git a/docs/views/basic/table.vue b/docs/views/basic/table.vue index 7d0e340..cdd5e3a 100644 --- a/docs/views/basic/table.vue +++ b/docs/views/basic/table.vue @@ -1,14 +1,14 @@ @@ -365,7 +364,6 @@ export default { }], checkbox: { disabled: false, - checked: false, text: '' } }, { @@ -486,4 +484,4 @@ export default { } } } - \ No newline at end of file + diff --git a/docs/views/form/checkbox.vue b/docs/views/form/checkbox.vue index 2070b6a..b3d104b 100644 --- a/docs/views/form/checkbox.vue +++ b/docs/views/form/checkbox.vue @@ -12,7 +12,7 @@

- +

@@ -20,7 +20,7 @@ ### 代码 ```html - + ``` ```javascript @@ -28,11 +28,19 @@ export default { data () { return { checkbox: { - checked: false, + // checked: false, 默认不选中 text: "我已阅读用户协议" } } }, + methods: { + handleChange (checkbox, vm, e) { + this.$Modal.confirm( + '复选框', + `checkbox: ${checkbox.checked}` + ) + } + } components: { rdCheckbox } @@ -45,9 +53,10 @@ export default { | 参数 | 类型 | 说明 | | :------------- |:-------------|:------------| -| checked | Bolean | 选中状态 | +| checked | Bolean | 选中状态 | +| disabled | Bolean | 禁用状态 | | text | String | 文字 | - +| change | 事件 | 复选框改变事件 参数checkbox;vm;event | @@ -64,19 +73,27 @@ export default { data () { return { checkbox: { - checked: false, text: '我已阅读用户协议' }, + checked: false, checkA: { disabled: false, - checked: false, + checked: true, text: '同意服务条款' } } }, + methods: { + handleChange (checkbox, vm, e) { + this.$Modal.confirm( + '复选框', + `checkbox: ${checkbox.checked}` + ) + } + }, components: { rdCheckbox, Mark } } - \ No newline at end of file + diff --git a/src/components/basic/table.vue b/src/components/basic/table.vue index 6c17de2..aff5828 100644 --- a/src/components/basic/table.vue +++ b/src/components/basic/table.vue @@ -70,15 +70,15 @@ - {{col.value}} - @@ -94,7 +94,7 @@ - +
@@ -108,18 +108,18 @@ {{row.state.value}} - {{action.text}} - { - row.checkbox.checked = val - }) + if (val) { // 全选时才设置 + this.table.tableData.forEach(row => { + row.checkbox.checked = val + }) + } }, touchCol (e, col) { if (col.sort && col.sort.func) { col.sort.func(e, col) } + }, + handleChange (checkbox, vm, e) { + if (!checkbox.checked && this.selectAll.checked) this.selectAll.checked = false } } } - \ No newline at end of file + diff --git a/src/components/form/checkbox.vue b/src/components/form/checkbox.vue index 13f1e23..1a92860 100644 --- a/src/components/form/checkbox.vue +++ b/src/components/form/checkbox.vue @@ -51,9 +51,9 @@ }