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 lines
3.3 KiB
1 lines
3.3 KiB
import{d as Q,B as v,c as a,t as U,p as X,o as s,b as c,F as Y,r as Z,n as w,K as _}from"./index-bVOhw2NF.js";const ee=Q({name:"EsTag",components:{},props:{options:{type:Object,default:()=>({})},datasets:{type:Array,default:()=>[]},eventData:{type:[String,Boolean,Number],default:""},element:{type:Object,default:()=>({})}},emits:["updateValue","update:eventData"],setup(e,{emit:l}){const{unselectedFontColor:i,unselectedBorderColor:u,unselectedBack:h,unselectedBackImg:g,unselectedFontSize:o,unselectedBorderWidth:n,selectedFontColor:f,selectedBorderColor:S,selectedBack:C,selectedBackImg:z,selectedFontSize:F,selectedBorderWidth:R,borderRadius:j,tabMargin:D,unselectedBorderRadius:L,selectedBorderRadius:V,tabBackground:x}=v(e.options),b=a(()=>e.datasets.length>0?e.datasets:[{label:"选项1",value:"1",checked:"checked"},{label:"选项2",value:"2"},{label:"选项3",value:"3"}]);U(()=>e.datasets,t=>{if(t&&t.length>0&&t&&t[0]){const r=t[0].value;l("update:eventData",r),l("updateValue",r)}},{immediate:!0});function E(t){b.value.forEach(r=>{r.checked=!1}),t.checked="checked",l("update:eventData",t.value),l("updateValue",t.value)}const I=a(()=>{const t=e.element.width,r=e.element.height;return{width:`${t}px`,height:`${r}px`,display:"flex","flex-direction":t>r?"row":"column","justify-content":"flex-start","align-items":"center","border-radius":`${j.value}px`,background:x,"background-size":"cover",overflow:"hidden"}}),T=a(()=>(t,r,O,W,p,A,k,K,M,N,y,q,m,B,G,H,$,J)=>{if(t.checked!=="checked")return{color:r,"font-size":`${A}px`,"border-style":"solid","border-width":`${k}px`,"border-color":O,"background-color":W,"background-image":p?`url(${p})`:"none","background-size":"100% 100%",display:"flex","justify-content":"center","align-items":"center",flex:"1",height:`calc(100% - ${k*2}px)`,width:"100%",cursor:"pointer","margin-right":`${B}px`,"border-radius":`${G}px`};{const d={},P=J.length;return $===0?d["border-right-width"]=0:$===P-1?d["border-left-width"]=0:(d["border-left-width"]=0,d["border-right-width"]=0),{color:K,"font-size":`${q}px`,"border-style":"solid","border-width":`${m}px`,"border-color":M,"background-color":N,"background-image":y?`url(${y})`:"none","background-size":"100% 100%",display:"flex","justify-content":"center","align-items":"center",flex:"1",height:`calc(100% - ${m*2}px)`,width:"100%",cursor:"pointer","margin-right":`${B}px`,"border-radius":`${H}px`,...d}}});return{handleSelect:E,...v(e.options),getStyle:I,getTabStyle:T,myRadioList:b,unselectedFontColor:i,unselectedBorderColor:u,unselectedBack:h,unselectedBackImg:g,unselectedFontSize:o,unselectedBorderWidth:n,selectedFontColor:f,selectedBorderColor:S,selectedBack:C,selectedBackImg:z,selectedFontSize:F,selectedBorderWidth:R,tabMargin:D,unselectedBorderRadius:L,selectedBorderRadius:V}}}),te=["onClick"];function re(e,l,i,u,h,g){return s(),c("div",{style:w(e.getStyle)},[(s(!0),c(Y,null,Z(e.myRadioList,(o,n)=>(s(),c("div",{key:o.value,style:w(e.getTabStyle(o,e.unselectedFontColor,e.unselectedBorderColor,e.unselectedBack,e.unselectedBackImg,e.unselectedFontSize,e.unselectedBorderWidth,e.selectedFontColor,e.selectedBorderColor,e.selectedBack,e.selectedBackImg,e.selectedFontSize,e.selectedBorderWidth,e.tabMargin,e.unselectedBorderRadius,e.selectedBorderRadius,n,e.myRadioList)),onClick:f=>e.handleSelect(o)},_(o.label),13,te))),128))],4)}const le=X(ee,[["render",re]]);export{le as default};
|