import{_ as t,a as e,c as n,w as s,C as r,F as l,D as o,Z as c,B as a,d,e as u,H as y,f as i,i as m}from"./index-BlslIQWi.js";const x=t({name:"UniSegmentedControl",emits:["clickItem"],props:{current:{type:Number,default:0},values:{type:Array,default:()=>[]},activeColor:{type:String,default:"#2979FF"},styleType:{type:String,default:"button"}},data:()=>({currentIndex:0}),watch:{current(t){t!==this.currentIndex&&(this.currentIndex=t)}},created(){this.currentIndex=this.current},methods:{_onClick(t){this.currentIndex!==t&&(this.currentIndex=t,this.$emit("clickItem",{currentIndex:t}))}}},[["render",function(t,x,_,p,b,f){const g=i,C=m;return e(),n(C,{class:c([["text"===_.styleType?"segmented-control--text":"segmented-control--button"],"segmented-control"]),style:a({borderColor:"text"===_.styleType?"":_.activeColor})},{default:s((()=>[(e(!0),r(l,null,o(_.values,((t,r)=>(e(),n(C,{class:c([["text"===_.styleType?"":"segmented-control__item--button",r===b.currentIndex&&"button"===_.styleType?"segmented-control__item--button--active":"",0===r&&"button"===_.styleType?"segmented-control__item--button--first":"",r===_.values.length-1&&"button"===_.styleType?"segmented-control__item--button--last":""],"segmented-control__item"]),key:r,style:a({backgroundColor:r===b.currentIndex&&"button"===_.styleType?_.activeColor:"",borderColor:r===b.currentIndex&&"text"===_.styleType||"button"===_.styleType?_.activeColor:"transparent"}),onClick:t=>f._onClick(r)},{default:s((()=>[d(C,null,{default:s((()=>[d(g,{style:a({color:r===b.currentIndex?"text"===_.styleType?_.activeColor:"#fff":"text"===_.styleType?"#000":_.activeColor}),class:c(["segmented-control__text","text"===_.styleType&&r===b.currentIndex?"segmented-control__item--text":""])},{default:s((()=>[u(y(t),1)])),_:2},1032,["style","class"])])),_:2},1024)])),_:2},1032,["class","style","onClick"])))),128))])),_:1},8,["class","style"])}],["__scopeId","data-v-bda4a78b"]]);export{x as _};
