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.
2 lines
15 KiB
2 lines
15 KiB
11 months ago
|
import{x as e,o as t,c as s,w as i,a,j as l,n,A as o,i as d,l as r,f as h,I as u,B as c,m as p,s as m,C as g,D as f,G as b,t as _,e as C,b as k,d as y,F as x,k as v,r as S,H as I,g as T}from"./index-ae8bbb19.js";import{_ as V}from"./u-icon.b463ad8a.js";import{r as F}from"./uni-app.es.ee1d5b08.js";import{_ as $}from"./_plugin-vue_export-helper.1b428a4d.js";import{E as z}from"./index.97c7afee.js";import{R as N}from"./index.b9e5c444.js";import{l as w,u as B,c as D}from"./cart.414ee15f.js";import"./index.c0835ba6.js";const L=$({name:"u-checkbox",emits:["update:modelValue","input","change"],props:{value:{type:Boolean,default:!1},modelValue:{type:Boolean,default:!1},name:{type:[String,Number],default:""},shape:{type:String,default:""},disabled:{type:[String,Boolean],default:""},labelDisabled:{type:[String,Boolean],default:""},activeColor:{type:String,default:""},iconSize:{type:[String,Number],default:""},labelSize:{type:[String,Number],default:""},size:{type:[String,Number],default:""}},data:()=>({parentDisabled:!1,newParams:{}}),created(){this.parent=this.$u.$parent.call(this,"u-checkbox-group"),this.parent&&this.parent.children.push(this)},computed:{valueCom(){return this.modelValue},isDisabled(){return""!==this.disabled?this.disabled:!!this.parent&&this.parent.disabled},isLabelDisabled(){return""!==this.labelDisabled?this.labelDisabled:!!this.parent&&this.parent.labelDisabled},checkboxSize(){return this.size?this.size:this.parent?this.parent.size:34},checkboxIconSize(){return this.iconSize?this.iconSize:this.parent?this.parent.iconSize:20},elActiveColor(){return this.activeColor?this.activeColor:this.parent?this.parent.activeColor:"primary"},elShape(){return this.shape?this.shape:this.parent?this.parent.shape:"square"},iconStyle(){let e={};return this.elActiveColor&&this.valueCom&&!this.isDisabled&&(e.borderColor=this.elActiveColor,e.backgroundColor=this.elActiveColor),e.width=this.$u.addUnit(this.checkboxSize),e.height=this.$u.addUnit(this.checkboxSize),e},iconColor(){return this.valueCom?"#ffffff":"transparent"},iconClass(){let e=[];return e.push("u-checkbox__icon-wrap--"+this.elShape),1==this.valueCom&&e.push("u-checkbox__icon-wrap--checked"),this.isDisabled&&e.push("u-checkbox__icon-wrap--disabled"),this.valueCom&&this.isDisabled&&e.push("u-checkbox__icon-wrap--disabled--checked"),e.join(" ")},checkboxStyle(){let e={};return this.parent&&this.parent.width&&(e.width=this.parent.width,e.flex=`0 0 ${this.parent.width}`),this.parent&&this.parent.wrap&&(e.width="100%",e.flex="0 0 100%"),e}},mounted(){this._emitEvent()},watch:{valueCom:{handler:function(e,t){this._emitEvent()}}},methods:{_emitEvent(){let e={value:this.valueCom,name:this.name};this.parent&&this.parent.emitEvent&&this.parent.emitEvent(e)},onClickLabel(){this.isLabelDisabled||this.isDisabled||this.setValue()},toggle(){this.isDisabled||this.setValue()},emitEvent(){let e={value:!this.valueCom,name:this.name};this.$emit("change",e),this.parent&&this.parent.emitEvent&&this.parent.emitEvent(e)},setValue(){let e=this.valueCom,t=0;if(this.parent&&this.parent.children&&this.parent.children.map((e=>{e.value&&t++})),1==e)this.emitEvent(),this.$emit("input",!e),this.$emit("update:modelValue",!e);else{if(this.parent&&t>=this.parent.max)return this.$u.toast(`最多可选${this.parent.max}项`);this.emitEvent(),this.$emit("input",!e),this.$emit("update:modelValue",!e)}}}},[["render",function(r,h,u,c,p,m){const g=F(e("u-icon"),V),f=d;return t(),s(f,{class:"u-checkbox",style:n([m.checkboxStyle])},{default:i((()=>[a(f,{class:l(["u-checkbox__icon-wrap",[m.iconClass]]),onClick:m.toggle,style:n([m.iconStyle])},{default:i((()=>[a(g,{class:"u-checkbox__icon-wrap__icon",name:"checkbox-mark",size:m.checkboxIconSize,color:m.iconColor},null,8,["size","color"])])),_:1},8,["onClick","class","style"]),a(f,{class:"u-checkbox__label",onClick:m.onClickLabel,style:n({fontSize:r.$u.addUnit(u.labelSize)})},{default:i((()=>[o(r.$slots,"default",{},void 0,!0)])),_:3},8,["onClick","style"])])),_:3},8,["style"])}],["__scopeId","data-v-486055df"]]);const j=$({name:"u-numberbox",emits:["update:modelVa
|