Skip to content

Switch 开关 ​

基于 Element Plus el-switch 的包装组件,提供开关切换功能。

基础用法 ​

基础的开关切换

基础开关

带文字提示

开

禁用状态

自定义颜色

自定义值

在线

当前值:1

API ​

Props ​

参数说明类型默认值
v-model / modelValue开关的值boolean | string | numberfalse
disabled是否禁用booleanfalse
active-text开启时的文字描述string-
inactive-text关闭时的文字描述string-
active-value开启时的值boolean | string | numbertrue
inactive-value关闭时的值boolean | string | numberfalse
active-color开启时的背景色string#409eff
inactive-color关闭时的背景色string#c0ccda
width开关的宽度number40
inline-prompt是否以内联形式展示文字提示booleanfalse

Events ​

事件名说明回调参数
change开关状态变化时触发(value: boolean | string | number)
update:modelValue值更新时触发(value: boolean | string | number)

Released under the MIT License.