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{D as e,E as t,G as a,H as l,J as i,L as s,b as o,o as r,c as n,w as c,d as u,M as d,k as h,i as p,at as f,K as m,a8 as b,al as C,O as g,e as y,t as v,j as S,r as _,au as D,av as z,aw as k,u as w,A as V,m as B,f as x,g as I,F as G,ax as N,ay as T,n as A}from"./index-DkGewvWo.js";import{_ as $}from"./u-navbar.CwZJfInl.js";import{r as H,b as j}from"./uni-app.es.Bo01BzMV.js";import{_ as P}from"./u-icon.x7ElsZU9.js";import{_ as L}from"./u-loading-icon.CdrBTsp-.js";import{_ as Q}from"./_plugin-vue_export-helper.BCo6x5W8.js";import{c as q}from"./car.CcI8AEaV.js";import{q as E}from"./wrongQuestionBook.C0b3lmDY.js";import"./u-status-bar.DDNs5qwz.js";const F=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 O=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