diff --git a/packages/checkbox/demo/index.vue b/packages/checkbox/demo/index.vue index 25975861f..d724a44b6 100644 --- a/packages/checkbox/demo/index.vue +++ b/packages/checkbox/demo/index.vue @@ -84,27 +84,6 @@ - - {{ $t('selectAll') }} - - - {{ $t('checkbox') }} {{ item }} - - - {{ $t('checkbox') }} {{ $t('other') }} - - - @@ -117,10 +96,7 @@ export default { customColor: '自定义颜色', title3: '复选框组', title4: '设置最大可选数', - title5: '搭配单元格组件使用', - title6: '取消和复选框组的绑定', - other: '其他', - selectAll: '全选', + title5: '搭配单元格组件使用' }, 'en-US': { checkbox: 'Checkbox', @@ -128,10 +104,7 @@ export default { customColor: 'Custom Color', title3: 'Checkbox Group', title4: 'Maximum amount of checked options', - title5: 'Inside a Cell', - title6: 'Cancel Bind Group', - other: 'other', - selectAll: 'select all', + title5: 'Inside a Cell' } }, @@ -148,34 +121,16 @@ export default { result: ['a', 'b'], result2: [], result3: [], - result4: [], - other: true, - selectAll: false, icon: { normal: 'https://img.yzcdn.cn/public_files/2017/10/13/c547715be149dd3faa817e4a948b40c4.png', active: 'https://img.yzcdn.cn/public_files/2017/10/13/793c77793db8641c4c325b7f25bf130d.png' } }; }, - watch: { - selectAll() { - if (this.selectAll) { - this.result4 = this.list; - } else { - this.result4 = []; - } - } - }, + methods: { toggle(index) { this.$refs.checkboxes[index].toggle(); - }, - select4() { - if (this.result4.length === 3) { - this.selectAll = true; - } else { - this.selectAll = false; - } } } }; diff --git a/packages/checkbox/en-US.md b/packages/checkbox/en-US.md index a46653a0d..8bf0995e6 100644 --- a/packages/checkbox/en-US.md +++ b/packages/checkbox/en-US.md @@ -145,6 +145,7 @@ export default { | label-disabled | Whether to disable label click | `Boolean` | `false` | | label-position | Can be set to `left` | `String` | `right` | | checked-color | Checked color | `String` | `#1989fa` | - | +| bind-group | Whether to bind with CheckboxGroup | `boolean` | `true` | ### CheckboxGroup API diff --git a/packages/checkbox/test/index.spec.js b/packages/checkbox/test/index.spec.js index 376eb6b5c..5df5e2ac7 100644 --- a/packages/checkbox/test/index.spec.js +++ b/packages/checkbox/test/index.spec.js @@ -75,12 +75,13 @@ test('checkbox group', async () => { await later(); expect(wrapper.vm.result).toEqual(['b']); }); + test('checkbox group unbind', async () => { const wrapper = mount({ template: ` - - + + `, components: { @@ -90,6 +91,7 @@ test('checkbox group unbind', async () => { data() { return { result: [], + value: false, list: ['a', 'b', 'c'] }; } @@ -99,10 +101,7 @@ test('checkbox group unbind', async () => { icons.at(3).trigger('click'); await later(); expect(wrapper.vm.result).toEqual([]); - - icons.at(3).trigger('click'); - await later(); - expect(wrapper.vm.result).toEqual([]); + expect(wrapper.vm.value).toBeTruthy(); }); test('click event', () => { diff --git a/packages/checkbox/zh-CN.md b/packages/checkbox/zh-CN.md index f6691422e..a3a5d31ff 100644 --- a/packages/checkbox/zh-CN.md +++ b/packages/checkbox/zh-CN.md @@ -79,7 +79,6 @@ export default { > 复选框 {{ item }} - 不与复选框组绑定 ``` @@ -149,7 +148,7 @@ export default { | label-disabled | 是否禁用复选框文本点击 | `Boolean` | `false` | - | | label-position | 文本位置,可选值为 `left` | `String` | `right` | 1.1.11 | | checked-color | 选中状态颜色 | `String` | `#1989fa` | 1.4.3 | -| bind-parent | 与复选框组绑定 | `boolean` | `true` | xxx | +| bind-group | 是否与复选框组绑定 | `boolean` | `true` | 1.6.26 | ### CheckboxGroup API diff --git a/packages/mixins/checkbox.js b/packages/mixins/checkbox.js index 63db397a8..109a3612e 100644 --- a/packages/mixins/checkbox.js +++ b/packages/mixins/checkbox.js @@ -18,9 +18,9 @@ export const CheckboxMixin = (parent, bem) => ({ type: String, default: 'round' }, - bindParent: { + bindGroup: { type: Boolean, - default: true, + default: true } },