Skip to content

Switch 开关

规则

js
{
    type:"switch",
    title:"是否上架",
    field:"is_show",
    value:"1",
    props: {
        activeValue:"1",
        inactiveValue:"0",
    },
}
{
    type:"switch",
    title:"是否上架",
    field:"is_show",
    value:"1",
    props: {
        activeValue:"1",
        inactiveValue:"0",
    },
}

参考:Element_Switch

value :Number | String

Props

参数说明类型可选值默认值
disabled是否禁用booleanfalse
widthswitch 的宽度(像素)number40
activeIconClassswitch 打开时所显示图标的类名,设置此项会忽略 active-textstring
inactiveIconClassswitch 关闭时所显示图标的类名,设置此项会忽略 inactive-textstring
activeTextswitch 打开时的文字描述string
inactiveTextswitch 关闭时的文字描述string
activeValueswitch 打开时的值boolean / string / numbertrue
inactiveValueswitch 关闭时的值boolean / string / numberfalse
activeColorswitch 打开时的背景色string#409EFF
inactiveColorswitch 关闭时的背景色string#C0CCDA
nameswitch 对应的 name 属性string

Events

事件名称说明回调参数
changeswitch 状态发生变化时的回调函数新状态的值