fix(Checkbox): only the icon is clickable when label-disabled

This commit is contained in:
陈嘉涵
2020-01-11 08:54:07 +08:00
parent 4ed3bd4c7e
commit 3d10d42fcc
10 changed files with 82 additions and 56 deletions

View File

@@ -54,7 +54,7 @@ export default {
### Custom Icon Size
```html
<van-checkbox v-model="checked" icon-size="25px">Checkbox</van-checkbox>
<van-checkbox v-model="checked" icon-size="24px">Checkbox</van-checkbox>
```
### Custom Icon

View File

@@ -39,7 +39,7 @@ export default {
### 禁用文本点击
通过设置`label-disabled`属性可以禁用复选框文本点击
设置`label-disabled`属性后,点击复选框图标以外的内容不会触发切换
```html
<van-checkbox v-model="checked" icon-disabled>复选框</van-checkbox>
@@ -66,7 +66,7 @@ export default {
通过`icon-size`属性可以自定义图标的大小
```html
<van-checkbox v-model="checked" icon-size="25px">复选框</van-checkbox>
<van-checkbox v-model="checked" icon-size="24px">复选框</van-checkbox>
```
### 自定义图标

View File

@@ -32,7 +32,7 @@
</demo-block>
<demo-block :title="$t('customIconSize')">
<van-checkbox v-model="checboxIcon" icon-size="25px">
<van-checkbox v-model="checboxIcon" icon-size="24px">
{{ $t('customIconSize') }}
</van-checkbox>
</demo-block>

View File

@@ -9,13 +9,13 @@ exports[`renders demo correctly 1`] = `
</div>
</div>
<div>
<div role="checkbox" tabindex="-1" aria-checked="false" class="van-checkbox">
<div role="checkbox" tabindex="-1" aria-checked="false" class="van-checkbox van-checkbox--disabled">
<div class="van-checkbox__icon van-checkbox__icon--round van-checkbox__icon--disabled"><i class="van-icon van-icon-success">
<!----></i></div><span class="van-checkbox__label van-checkbox__label--disabled">
复选框
</span>
</div>
<div role="checkbox" tabindex="-1" aria-checked="true" class="van-checkbox">
<div role="checkbox" tabindex="-1" aria-checked="true" class="van-checkbox van-checkbox--disabled">
<div class="van-checkbox__icon van-checkbox__icon--round van-checkbox__icon--disabled van-checkbox__icon--checked"><i class="van-icon van-icon-success">
<!----></i></div><span class="van-checkbox__label van-checkbox__label--disabled">
复选框
@@ -23,7 +23,7 @@ exports[`renders demo correctly 1`] = `
</div>
</div>
<div>
<div role="checkbox" tabindex="0" aria-checked="true" class="van-checkbox">
<div role="checkbox" tabindex="0" aria-checked="true" class="van-checkbox van-checkbox--label-disabled">
<div class="van-checkbox__icon van-checkbox__icon--round van-checkbox__icon--checked"><i class="van-icon van-icon-success">
<!----></i></div><span class="van-checkbox__label">
复选框
@@ -48,7 +48,7 @@ exports[`renders demo correctly 1`] = `
</div>
<div>
<div role="checkbox" tabindex="0" aria-checked="true" class="van-checkbox">
<div class="van-checkbox__icon van-checkbox__icon--round van-checkbox__icon--checked" style="font-size: 25px;"><i class="van-icon van-icon-success">
<div class="van-checkbox__icon van-checkbox__icon--round van-checkbox__icon--checked" style="font-size: 24px;"><i class="van-icon van-icon-success">
<!----></i></div><span class="van-checkbox__label">
自定义大小
</span>

View File

@@ -27,7 +27,7 @@ exports[`icon-size prop 1`] = `
`;
exports[`label disabled 1`] = `
<div role="checkbox" tabindex="0" aria-checked="undefined" class="van-checkbox">
<div role="checkbox" tabindex="0" aria-checked="undefined" class="van-checkbox van-checkbox--label-disabled">
<div class="van-checkbox__icon van-checkbox__icon--round"><i class="van-icon van-icon-success">
<!----></i></div><span class="van-checkbox__label">Label</span>
</div>