mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
[improvement] SwitchCell: support form-filed (#479)
This commit is contained in:
parent
309cf21075
commit
c8836b8d6f
13
dist/switch-cell/index.js
vendored
13
dist/switch-cell/index.js
vendored
@ -1,20 +1,31 @@
|
|||||||
Component({
|
Component({
|
||||||
|
behaviors: ['wx://form-field'],
|
||||||
|
|
||||||
options: {
|
options: {
|
||||||
addGlobalClass: true
|
addGlobalClass: true
|
||||||
},
|
},
|
||||||
|
|
||||||
properties: {
|
properties: {
|
||||||
title: String,
|
title: String,
|
||||||
checked: Boolean,
|
|
||||||
border: Boolean,
|
border: Boolean,
|
||||||
loading: Boolean,
|
loading: Boolean,
|
||||||
disabled: Boolean,
|
disabled: Boolean,
|
||||||
|
checked: {
|
||||||
|
type: Boolean,
|
||||||
|
observer(value) {
|
||||||
|
this.setData({ value });
|
||||||
|
}
|
||||||
|
},
|
||||||
size: {
|
size: {
|
||||||
type: String,
|
type: String,
|
||||||
value: '26px'
|
value: '26px'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
attached() {
|
||||||
|
this.setData({ value: this.data.checked });
|
||||||
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
onChange(event) {
|
onChange(event) {
|
||||||
this.triggerEvent('change', event.detail);
|
this.triggerEvent('change', event.detail);
|
||||||
|
@ -61,6 +61,7 @@ Page({
|
|||||||
|
|
||||||
| 参数 | 说明 | 类型 | 默认值 |
|
| 参数 | 说明 | 类型 | 默认值 |
|
||||||
|-----------|-----------|-----------|-------------|
|
|-----------|-----------|-----------|-------------|
|
||||||
|
| name | 在表单内提交时的标识符 | `String` | - |
|
||||||
| checked | 开关状态 | `Boolean` | - |
|
| checked | 开关状态 | `Boolean` | - |
|
||||||
| title | 左侧标题 | `String` | `''` |
|
| title | 左侧标题 | `String` | `''` |
|
||||||
| loading | 是否为加载状态 | `Boolean` | `false` |
|
| loading | 是否为加载状态 | `Boolean` | `false` |
|
||||||
|
@ -1,20 +1,31 @@
|
|||||||
Component({
|
Component({
|
||||||
|
behaviors: ['wx://form-field'],
|
||||||
|
|
||||||
options: {
|
options: {
|
||||||
addGlobalClass: true
|
addGlobalClass: true
|
||||||
},
|
},
|
||||||
|
|
||||||
properties: {
|
properties: {
|
||||||
title: String,
|
title: String,
|
||||||
checked: Boolean,
|
|
||||||
border: Boolean,
|
border: Boolean,
|
||||||
loading: Boolean,
|
loading: Boolean,
|
||||||
disabled: Boolean,
|
disabled: Boolean,
|
||||||
|
checked: {
|
||||||
|
type: Boolean,
|
||||||
|
observer(value) {
|
||||||
|
this.setData({ value });
|
||||||
|
}
|
||||||
|
},
|
||||||
size: {
|
size: {
|
||||||
type: String,
|
type: String,
|
||||||
value: '26px'
|
value: '26px'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
attached() {
|
||||||
|
this.setData({ value: this.data.checked });
|
||||||
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
onChange(event) {
|
onChange(event) {
|
||||||
this.triggerEvent('change', event.detail);
|
this.triggerEvent('change', event.detail);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user