diff --git a/packages/checkbox/en-US.md b/packages/checkbox/en-US.md index 39d17c5b6..a01b3be0f 100644 --- a/packages/checkbox/en-US.md +++ b/packages/checkbox/en-US.md @@ -159,6 +159,7 @@ export default { | Event | Description | Parameters | |------|------|------| | change | Triggered when value changed | current value | +| click | Triggered when click checkbox | event: Event | ### CheckboxGroup Event diff --git a/packages/checkbox/test/index.spec.js b/packages/checkbox/test/index.spec.js index 77d5478cd..bb9311ad7 100644 --- a/packages/checkbox/test/index.spec.js +++ b/packages/checkbox/test/index.spec.js @@ -70,3 +70,19 @@ test('checkbox group', () => { icons.at(0).trigger('click'); expect(wrapper.vm.result).toEqual(['b']); }); + +test('click event', () => { + const onClick = jest.fn(); + const wrapper = mount(Checkbox, { + listeners: { + click: onClick + } + }); + + wrapper.trigger('click'); + expect(onClick.mock.calls.length).toEqual(1); + + const icon = wrapper.find('.van-checkbox__icon'); + icon.trigger('click'); + expect(onClick.mock.calls.length).toEqual(2); +}); diff --git a/packages/checkbox/zh-CN.md b/packages/checkbox/zh-CN.md index 0951e9961..16a79e5d2 100644 --- a/packages/checkbox/zh-CN.md +++ b/packages/checkbox/zh-CN.md @@ -144,8 +144,8 @@ export default { | name | 标识符 | `any` | - | - | | shape | 形状,可选值为 `square` | `String` | `round` | - | | v-model | 是否为选中状态 | `Boolean` | `false` | - | -| disabled | 是否禁用单选框 | `Boolean` | `false` | - | -| label-disabled | 是否禁用单选框文本点击 | `Boolean` | `false` | - | +| disabled | 是否禁用复选框 | `Boolean` | `false` | - | +| label-disabled | 是否禁用复选框文本点击 | `Boolean` | `false` | - | | label-position | 文本位置,可选值为 `left` | `String` | `right` | 1.1.11 | | checked-color | 选中状态颜色 | `String` | `#1989fa` | 1.4.3 | @@ -154,7 +154,7 @@ export default { | 参数 | 说明 | 类型 | 默认值 | 版本 | |------|------|------|------|------| | v-model | 所有选中项的标识符 | `Array` | - | - | -| disabled | 是否禁用所有单选框 | `Boolean` | `false` | - | +| disabled | 是否禁用所有复选框 | `Boolean` | `false` | - | | max | 设置最大可选数,0 为无限制 | `Number` | `0` | - | ### Checkbox Event @@ -162,6 +162,7 @@ export default { | 事件名称 | 说明 | 回调参数 | |------|------|------| | change | 当绑定值变化时触发的事件 | 当前组件的值 | +| click | 点击复选框时触发 | event: Event | ### CheckboxGroup Event diff --git a/packages/mixins/checkbox.js b/packages/mixins/checkbox.js index 9df5f55be..d2e136a31 100644 --- a/packages/mixins/checkbox.js +++ b/packages/mixins/checkbox.js @@ -59,8 +59,8 @@ export const CheckboxMixin = (parent, bem) => ({ return (