Skip to content

vSwitch 开关

开关切换组件。

基础用法

vue
<script setup>
import { ref } from 'vue'
import { vSwitch } from '@twi1i9ht/visual-lib'

const checked = ref(false)
</script>

<template>
  <vSwitch v-model="checked" />
</template>

带文字

vue
<template>
  <vSwitch v-model="checked" active-text="开" inactive-text="关" />
</template>

Props

属性类型默认值说明
modelValuebooleanfalse绑定值
disabledbooleanfalse禁用
activeTextstring打开时的文字
inactiveTextstring关闭时的文字
activeColorstring'#409eff'打开时的颜色
inactiveColorstring'#c0ccda'关闭时的颜色
size'small' | 'default' | 'large''default'尺寸

Events

事件名参数说明
update:modelValuevalue值变化
changevalue状态变化

Released under the MIT License.