Switch 开关

表示两种相互对立的状态间的切换,多用于触发「开/关」。

基本用法

显示代码

禁用状态

显示代码

改变前的回调

返回false会阻止Switch的切换

显示代码

Attributes

参数 说明 类型 可选值 默认值
checked 绑定值 booleanx false
disabled 是否禁用 boolean false
width switch 的宽度(像素) number 40
activeColor switch 打开时的背景色 string #409EFF
inactiveColor switch 关闭时的背景色 string #C0CCDA
name switch 对应的 name 属性 string

Events

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

Slot

name 说明
checked-slot ?