UNPKG

uv-ui

Version:

基于vue3的移动端组件库

2 lines (1 loc) 904 B
"use strict";const e=require("vue");require("./switch.vue_vue_type_style_index_0_lang.cjs");const r={name:"UvSwitch"},d=Object.assign(r,{props:{modelValue:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},activeColor:{type:String},inactiveColor:{type:String},size:{type:[String,Number]}},emits:["update:modelValue"],setup(t,{emit:o}){const l=t;function c(){l.disabled||o("update:modelValue",!l.modelValue)}const s=e.computed(()=>{const{size:a,activeColor:i,inactiveColor:n,modelValue:u}=l;return{fontSize:a+"px",backgroundColor:u?i:n}});return(a,i)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["uv-switch",[t.modelValue?"uv-switch-on":"",t.disabled?"uv-switch-disabled":""]]),style:e.normalizeStyle(e.unref(s)),onClick:c},[e.createElementVNode("div",{class:e.normalizeClass(["uv-switch-circle",t.modelValue?" uv-switch-circle-on":""])},null,2)],6))}});module.exports=d;