Appearance

so-switch

so-switch组件 是继承 u-switch 接口包装的开关组件。

代码示例

模板代码

<so-switch v-model="form.switchVal" on-value="1" off-value="2" @change="changeSwitch"></so-switch>

js代码

...
data(){
    return {
        form:{
            switchVal:'1'
        }
    }
},
methods:{
    changeSwitch(value){
        console.log(value);
    },
}
...

Props

参数说明类型默认值可选值
v-model/valueBoolean,String,Number''-
on-value开启时对应值Boolean,String,Numbertrue-
off-value关闭对应值Boolean,String,Numberfalse-

Events

方法名参数说明
changeFunction(val)返回切换值

Method

方法名参数说明

更多说明请查看 u-switch组件介绍open in new window