mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
[new feature] SwitchCell: add active-value & inactive-value prop (#1298)
This commit is contained in:
parent
1dd9218a67
commit
cbdccdf820
@ -62,13 +62,15 @@ Page({
|
|||||||
| 参数 | 说明 | 类型 | 默认值 |
|
| 参数 | 说明 | 类型 | 默认值 |
|
||||||
|-----------|-----------|-----------|-------------|
|
|-----------|-----------|-----------|-------------|
|
||||||
| name | 在表单内提交时的标识符 | `String` | - |
|
| name | 在表单内提交时的标识符 | `String` | - |
|
||||||
| checked | 开关状态 | `Boolean` | - |
|
| checked | 开关状态 | `any` | `false` |
|
||||||
| title | 左侧标题 | `String` | `''` |
|
| title | 左侧标题 | `String` | `''` |
|
||||||
| loading | 是否为加载状态 | `Boolean` | `false` |
|
| loading | 是否为加载状态 | `Boolean` | `false` |
|
||||||
| disabled | 是否为禁用状态 | `Boolean` | `false` |
|
| disabled | 是否为禁用状态 | `Boolean` | `false` |
|
||||||
| size | 开关尺寸 | `String` | `24px` |
|
| size | 开关尺寸 | `String` | `24px` |
|
||||||
| active-color | 开关打开时的背景色 | `String` | `#1989fa` |
|
| active-color | 开关打开时的背景色 | `String` | `#1989fa` |
|
||||||
| inactive-color | 开关关闭时的背景色 | `String` | `#fff` |
|
| inactive-color | 开关关闭时的背景色 | `String` | `#fff` |
|
||||||
|
| active-value | 打开时的值 | `any` | `true` |
|
||||||
|
| inactive-value | 关闭时的值 | `any` | `false` |
|
||||||
|
|
||||||
### Event
|
### Event
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ VantComponent({
|
|||||||
field: true,
|
field: true,
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
|
value: null,
|
||||||
title: String,
|
title: String,
|
||||||
border: Boolean,
|
border: Boolean,
|
||||||
checked: Boolean,
|
checked: Boolean,
|
||||||
@ -14,6 +15,14 @@ VantComponent({
|
|||||||
size: {
|
size: {
|
||||||
type: String,
|
type: String,
|
||||||
value: '24px'
|
value: '24px'
|
||||||
|
},
|
||||||
|
activeValue: {
|
||||||
|
type: null,
|
||||||
|
value: true
|
||||||
|
},
|
||||||
|
inactiveValue: {
|
||||||
|
type: null,
|
||||||
|
value: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
disabled="{{ disabled }}"
|
disabled="{{ disabled }}"
|
||||||
active-color="{{ activeColor }}"
|
active-color="{{ activeColor }}"
|
||||||
inactive-color="{{ inactiveColor }}"
|
inactive-color="{{ inactiveColor }}"
|
||||||
|
active-value="{{ activeValue }}"
|
||||||
|
inactive-value="{{ inactiveValue }}"
|
||||||
custom-class="van-switch-cell__switch"
|
custom-class="van-switch-cell__switch"
|
||||||
bind:change="onChange"
|
bind:change="onChange"
|
||||||
/>
|
/>
|
||||||
|
@ -92,7 +92,7 @@ Page({
|
|||||||
| 参数 | 说明 | 类型 | 默认值 |
|
| 参数 | 说明 | 类型 | 默认值 |
|
||||||
|-----------|-----------|-----------|-------------|
|
|-----------|-----------|-----------|-------------|
|
||||||
| name | 在表单内提交时的标识符 | `String` | - |
|
| name | 在表单内提交时的标识符 | `String` | - |
|
||||||
| checked | 开关选中状态 | `Boolean` | `false` |
|
| checked | 开关选中状态 | `any` | `false` |
|
||||||
| loading | 是否为加载状态 | `Boolean` | `false` |
|
| loading | 是否为加载状态 | `Boolean` | `false` |
|
||||||
| disabled | 是否为禁用状态 | `Boolean` | `false` |
|
| disabled | 是否为禁用状态 | `Boolean` | `false` |
|
||||||
| size | 开关尺寸 | `String` | `30px` |
|
| size | 开关尺寸 | `String` | `30px` |
|
||||||
|
Loading…
x
Reference in New Issue
Block a user