You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
14 KiB

1 week ago
  1. import{H as e,J as t,K as a,L as l,M as i,O as s,b as o,o as r,c as n,w as c,d as u,P as d,k as h,i as p,aw as f,N as m,ab as b,ao as C,R as g,e as y,t as v,j as S,r as _,ax as D,ay as z,az as k,u as w,C as B,m as V,f as x,g as I,F as N,aA as T,aB as A,n as G}from"./index-IX2tYR8R.js";import{_ as $}from"./u-navbar.BTvKBpLV.js";import{r as H,b as j}from"./uni-app.es.Bc5t55A8.js";import{_ as P}from"./u-icon.sW6sruaF.js";import{_ as L}from"./u-loading-icon.pEvsKDSP.js";import{_ as Q}from"./_plugin-vue_export-helper.BCo6x5W8.js";import{c as q}from"./car.C_k88K1b.js";import{q as R}from"./wrongQuestionBook.Beoh-3Vq.js";import"./u-status-bar.weuqoXTS.js";const E=Q({name:"u-switch",mixins:[a,l,e({props:{loading:{type:Boolean,default:()=>t.switch.loading},disabled:{type:Boolean,default:()=>t.switch.disabled},size:{type:[String,Number],default:()=>t.switch.size},activeColor:{type:String,default:()=>t.switch.activeColor},inactiveColor:{type:String,default:()=>t.switch.inactiveColor},modelValue:{type:[Boolean,String,Number],default:()=>t.switch.value},activeValue:{type:[String,Number,Boolean],default:()=>t.switch.activeValue},inactiveValue:{type:[String,Number,Boolean],default:()=>t.switch.inactiveValue},asyncChange:{type:Boolean,default:()=>t.switch.asyncChange},space:{type:[String,Number],default:()=>t.switch.space}}})],watch:{modelValue:{immediate:!0,handler(e){e!==this.inactiveValue&&this.activeValue}}},data:()=>({bgColor:"#ffffff"}),computed:{isActive(){return this.modelValue===this.activeValue},switchStyle(){let e={};return e.width=i(2*this.size+2),e.height=i(Number(this.size)+2),this.customInactiveColor&&(e.borderColor="rgba(0, 0, 0, 0)"),e.backgroundColor=this.isActive?this.activeColor:this.inactiveColor,e},nodeStyle(){let e={};e.width=i(this.size-this.space),e.height=i(this.size-this.space);const t=this.isActive?i(this.space):i(this.size);return e.transform=`translateX(-${t})`,e},bgStyle(){let e={};return e.width=i(2*Number(this.size)-this.size/2),e.height=i(this.size),e.backgroundColor=this.inactiveColor,e.transform=`scale(${this.isActive?0:1})`,e},customInactiveColor(){return"#fff"!==this.inactiveColor&&"#ffffff"!==this.inactiveColor}},emits:["update:modelValue","change"],methods:{addStyle:s,clickHandler(){if(!this.disabled&&!this.loading){const e=this.isActive?this.inactiveValue:this.activeValue;this.asyncChange||this.$emit("update:modelValue",e),this.$nextTick((()=>{this.$emit("change",e)}))}}}},[["render",function(e,t,a,l,i,s){const f=p,m=H(o("u-loading-icon"),L);return r(),n(f,{class:h(["u-switch cursor-pointer",[e.disabled&&"u-switch--disabled"]]),style:d([s.switchStyle,s.addStyle(e.customStyle)]),onClick:s.clickHandler},{default:c((()=>[u(f,{class:"u-switch__bg",style:d([s.bgStyle])},null,8,["style"]),u(f,{class:h(["u-switch__node",[e.modelValue&&"u-switch__node--on"]]),style:d([s.nodeStyle]),ref:"u-switch__node"},{default:c((()=>[u(m,{show:e.loading,mode:"circle",timingFunction:"linear",color:e.modelValue?e.activeColor:"#AAABAD",size:.6*e.size},null,8,["show","color","size"])])),_:1},8,["class","style"])])),_:1},8,["class","style","onClick"])}],["__scopeId","data-v-82b7622f"]]);const F=Q({name:"u-radio",mixins:[a,l,e({props:{name:{type:[String,Number,Boolean],default:()=>t.radio.name},shape:{type:String,default:()=>t.radio.shape},disabled:{type:[String,Boolean],default:()=>t.radio.disabled},labelDisabled:{type:[String,Boolean],default:()=>t.radio.labelDisabled},activeColor:{type:String,default:()=>t.radio.activeColor},inactiveColor:{type:String,default:()=>t.radio.inactiveColor},iconSize:{type:[String,Number],default:()=>t.radio.iconSize},labelSize:{type:[String,Number],default:()=>t.radio.labelSize},label:{type:[String,Number],default:()=>t.radio.label},size:{type:[String,Number],default:()=>t.radio.size},color:{type:String,default:()=>t.radio.color},labelColor:{type:String,default:()=>t.radio.labelColor},iconColor:{type:String,default:()=>t.radio.iconColor}}})],data:()=>({checked:!1,parentData:{iconSize:12,labelDisabled:null,disabled:null,shape:null,activeColor:null,inactiveColor:null,size:18,value:null,modelVal