import{_ as t,o as e,p as n,w as s,e as r,F as o,y as l,a4 as a,B as c,f as u,k as d,t as y,C as i,i as m}from"./index-2PZN6pGH.js";const p=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,p,x,_,b,f){const g=i,C=m;return e(),n(C,{class:a([["text"===x.styleType?"segmented-control--text":"segmented-control--button"],"segmented-control"]),style:c({borderColor:"text"===x.styleType?"":x.activeColor})},{default:s((()=>[(e(!0),r(o,null,l(x.values,((t,r)=>(e(),n(C,{class:a([["text"===x.styleType?"":"segmented-control__item--button",r===b.currentIndex&&"button"===x.styleType?"segmented-control__item--button--active":"",0===r&&"button"===x.styleType?"segmented-control__item--button--first":"",r===x.values.length-1&&"button"===x.styleType?"segmented-control__item--button--last":""],"segmented-control__item"]),key:r,style:c({backgroundColor:r===b.currentIndex&&"button"===x.styleType?x.activeColor:"",borderColor:r===b.currentIndex&&"text"===x.styleType||"button"===x.styleType?x.activeColor:"transparent"}),onClick:t=>f._onClick(r)},{default:s((()=>[u(C,null,{default:s((()=>[u(g,{style:c({color:r===b.currentIndex?"text"===x.styleType?x.activeColor:"#fff":"text"===x.styleType?"#000":x.activeColor}),class:a(["segmented-control__text","text"===x.styleType&&r===b.currentIndex?"segmented-control__item--text":""])},{default:s((()=>[d(y(t),1)])),_:2},1032,["style","class"])])),_:2},1024)])),_:2},1032,["class","style","onClick"])))),128))])),_:1},8,["class","style"])}],["__scopeId","data-v-bda4a78b"]]);export{p as _};
