# Switch 开关

switch

# 规则

{
    type: 'switch',
    title: '开关',
    field: 'switch',
    value: 1,
    props: {
        activeValue:1,
        inactiveValue:0
    }
}

参考:Vant_Switch (opens new window)

value :Number | String | Boolean

# Props

参数 说明 类型 默认值
loading 是否为加载状态 boolean false
disabled 是否为禁用状态 boolean false
size 开关按钮的尺寸,默认单位为 px number | string 26px
active-color 打开时的背景色 string #1989fa
inactive-color 关闭时的背景色 string rgba(120, 120, 128, 0.16)
active-value 打开时对应的值 any true
inactive-value 关闭时对应的值 any false

# Events

事件名 说明 回调参数
change 开关状态切换时触发 value: any
click 点击时触发 event: MouseEvent