mirror of
https://github.com/youzan/vant.git
synced 2025-10-22 11:54:02 +00:00
docs: complete some examples of button/cell/checkbox/radio
This commit is contained in:
@@ -33,6 +33,12 @@ export default {
|
||||
<van-checkbox v-model="checked" disabled>Checkbox</van-checkbox>
|
||||
```
|
||||
|
||||
### Disabled Label Click
|
||||
|
||||
```html
|
||||
<van-checkbox v-model="checked" label-disabled>Checkbox</van-checkbox>
|
||||
```
|
||||
|
||||
### Custom Shape
|
||||
|
||||
```html
|
||||
@@ -45,6 +51,12 @@ export default {
|
||||
<van-checkbox v-model="checked" checked-color="#07c160">Checkbox</van-checkbox>
|
||||
```
|
||||
|
||||
### Custom Icon Size
|
||||
|
||||
```html
|
||||
<van-checkbox v-model="checked" icon-size="25px">Checkbox</van-checkbox>
|
||||
```
|
||||
|
||||
### Custom Icon
|
||||
|
||||
Use icon slot to custom icon
|
||||
|
@@ -37,6 +37,14 @@ export default {
|
||||
<van-checkbox v-model="checked" disabled>复选框</van-checkbox>
|
||||
```
|
||||
|
||||
### 禁用文本点击
|
||||
|
||||
通过设置`label-disabled`属性可以禁用复选框文本点击
|
||||
|
||||
```html
|
||||
<van-checkbox v-model="checked" icon-disabled>复选框</van-checkbox>
|
||||
```
|
||||
|
||||
### 自定义形状
|
||||
|
||||
将`shape`属性设置为`square`,复选框的形状会变成方形
|
||||
@@ -53,6 +61,14 @@ export default {
|
||||
<van-checkbox v-model="checked" checked-color="#07c160">复选框</van-checkbox>
|
||||
```
|
||||
|
||||
### 自定义大小
|
||||
|
||||
通过`icon-size`属性可以自定义图标的大小
|
||||
|
||||
```html
|
||||
<van-checkbox v-model="checked" icon-size="25px">复选框</van-checkbox>
|
||||
```
|
||||
|
||||
### 自定义图标
|
||||
|
||||
通过 icon 插槽自定义图标,可以通过`slotProps`判断是否为选中状态
|
||||
|
@@ -13,6 +13,12 @@
|
||||
</van-checkbox>
|
||||
</demo-block>
|
||||
|
||||
<demo-block :title="$t('disabledLabelClick')">
|
||||
<van-checkbox v-model="checkboxLabel" label-disabled>
|
||||
{{ $t('checkbox') }}
|
||||
</van-checkbox>
|
||||
</demo-block>
|
||||
|
||||
<demo-block :title="$t('customShape')">
|
||||
<van-checkbox v-model="checkboxShape" shape="square">
|
||||
{{ $t('customColor') }}
|
||||
@@ -25,6 +31,12 @@
|
||||
</van-checkbox>
|
||||
</demo-block>
|
||||
|
||||
<demo-block :title="$t('customIconSize')">
|
||||
<van-checkbox v-model="checboxIcon" icon-size="25px">
|
||||
{{ $t('customIconSize') }}
|
||||
</van-checkbox>
|
||||
</demo-block>
|
||||
|
||||
<demo-block :title="$t('customIcon')">
|
||||
<van-checkbox v-model="checkbox3">
|
||||
{{ $t('customIcon') }}
|
||||
@@ -89,6 +101,7 @@ export default {
|
||||
'zh-CN': {
|
||||
checkbox: '复选框',
|
||||
customIcon: '自定义图标',
|
||||
customIconSize: '自定义大小',
|
||||
customColor: '自定义颜色',
|
||||
customShape: '自定义形状',
|
||||
title3: '复选框组',
|
||||
@@ -96,11 +109,13 @@ export default {
|
||||
title5: '搭配单元格组件使用',
|
||||
toggleAll: '全选与反选',
|
||||
checkAll: '全选',
|
||||
inverse: '反选'
|
||||
inverse: '反选',
|
||||
disabledLabelClick: '禁用复选框文本点击'
|
||||
},
|
||||
'en-US': {
|
||||
checkbox: 'Checkbox',
|
||||
customIcon: 'Custom Icon',
|
||||
customIconSize: 'Custom Icon Size',
|
||||
customColor: 'Custom Color',
|
||||
customShape: 'Custom Shape',
|
||||
title3: 'Checkbox Group',
|
||||
@@ -108,7 +123,8 @@ export default {
|
||||
title5: 'Inside a Cell',
|
||||
toggleAll: 'Toggle All',
|
||||
checkAll: 'Check All',
|
||||
inverse: 'Inverse'
|
||||
inverse: 'Inverse',
|
||||
disabledLabelClick: 'Disable the click event of label'
|
||||
}
|
||||
},
|
||||
|
||||
@@ -118,6 +134,8 @@ export default {
|
||||
checkbox2: true,
|
||||
checkbox3: true,
|
||||
checkboxShape: true,
|
||||
checkboxLabel: true,
|
||||
checboxIcon: true,
|
||||
list: [
|
||||
'a',
|
||||
'b',
|
||||
|
@@ -22,6 +22,14 @@ exports[`renders demo correctly 1`] = `
|
||||
</span>
|
||||
</div>
|
||||
</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"><i class="van-icon van-icon-success">
|
||||
<!----></i></div><span class="van-checkbox__label">
|
||||
复选框
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div role="checkbox" tabindex="0" aria-checked="true" class="van-checkbox">
|
||||
<div class="van-checkbox__icon van-checkbox__icon--square van-checkbox__icon--checked"><i class="van-icon van-icon-success">
|
||||
@@ -38,6 +46,14 @@ exports[`renders demo correctly 1`] = `
|
||||
</span>
|
||||
</div>
|
||||
</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">
|
||||
<!----></i></div><span class="van-checkbox__label">
|
||||
自定义大小
|
||||
</span>
|
||||
</div>
|
||||
</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"><img src="https://img.yzcdn.cn/vant/user-active.png"></div><span class="van-checkbox__label">
|
||||
|
Reference in New Issue
Block a user