mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-05-22 06:31:45 +08:00
feat(Checkbox): icon slot add disabled param (#8839)
This commit is contained in:
parent
c426125e2c
commit
2e889b2641
@ -90,7 +90,7 @@ export default defineComponent({
|
||||
style={{ fontSize: addUnit(iconSize) }}
|
||||
>
|
||||
{slots.icon ? (
|
||||
slots.icon({ checked })
|
||||
slots.icon({ checked, disabled: disabled.value })
|
||||
) : (
|
||||
<Icon name="success" style={iconStyle.value} />
|
||||
)}
|
||||
|
@ -284,9 +284,9 @@ export default {
|
||||
### Checkbox Slots
|
||||
|
||||
| Name | Description | SlotProps |
|
||||
| ------- | ------------ | ------------------ |
|
||||
| ------- | ------------ | ----------------------------------------- |
|
||||
| default | Custom label | - |
|
||||
| icon | Custom icon | _checked: boolean_ |
|
||||
| icon | Custom icon | _{ checked: boolean, disabled: boolean }_ |
|
||||
|
||||
### CheckboxGroup Methods
|
||||
|
||||
|
@ -302,9 +302,9 @@ export default {
|
||||
### Checkbox Slots
|
||||
|
||||
| 名称 | 说明 | 参数 |
|
||||
| ------- | ---------- | ------------------ |
|
||||
| ------- | ---------- | ----------------------------------------- |
|
||||
| default | 自定义文本 | - |
|
||||
| icon | 自定义图标 | _checked: boolean_ |
|
||||
| icon | 自定义图标 | _{ checked: boolean, disabled: boolean }_ |
|
||||
|
||||
### CheckboxGroup 方法
|
||||
|
||||
|
@ -15,3 +15,9 @@ exports[`should adjust label position when using label-position prop 1`] = `
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`should render icon slot correctly 1`] = `
|
||||
<div class="van-checkbox__icon van-checkbox__icon--round">
|
||||
checked: false, disabled: false
|
||||
</div>
|
||||
`;
|
||||
|
@ -105,3 +105,14 @@ test('should emit click event when checkbox icon is clicked', async () => {
|
||||
icon.trigger('click');
|
||||
expect(onClick).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
|
||||
test('should render icon slot correctly', async () => {
|
||||
const wrapper = mount(Checkbox, {
|
||||
slots: {
|
||||
icon: ({ checked, disabled }) =>
|
||||
`checked: ${checked}, disabled: ${disabled}`,
|
||||
},
|
||||
});
|
||||
|
||||
expect(wrapper.find('.van-checkbox__icon').html()).toMatchSnapshot();
|
||||
});
|
||||
|
@ -195,9 +195,9 @@ export default {
|
||||
### Radio Slots
|
||||
|
||||
| Name | Description | SlotProps |
|
||||
| ------- | ------------ | ------------------ |
|
||||
| ------- | ------------ | ----------------------------------------- |
|
||||
| default | Custom label | - |
|
||||
| icon | Custom icon | _checked: boolean_ |
|
||||
| icon | Custom icon | _{ checked: boolean, disabled: boolean }_ |
|
||||
|
||||
### Less Variables
|
||||
|
||||
|
@ -209,9 +209,9 @@ export default {
|
||||
### Radio Slots
|
||||
|
||||
| 名称 | 说明 | 参数 |
|
||||
| ------- | ---------- | ------------------ |
|
||||
| ------- | ---------- | ----------------------------------------- |
|
||||
| default | 自定义文本 | - |
|
||||
| icon | 自定义图标 | _checked: boolean_ |
|
||||
| icon | 自定义图标 | _{ checked: boolean, disabled: boolean }_ |
|
||||
|
||||
### 样式变量
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user