import{av as e,_ as c,b as t,h as l,d as o,o as a,p as n,w as i,B as s,v as f,f as r,k as d,t as u,a4 as k,C as h,i as v}from"./index-2PZN6pGH.js";import{_ as C}from"./uni-card.CpdfOoXJ.js";import{_ as p}from"./uni-section.BISPxi99.js";import{_ as g}from"./uni-nav-bar.Cm2pcZXB.js";const y={en:{"uni-fav.collect":"collect","uni-fav.collected":"collected"},"zh-Hans":{"uni-fav.collect":"收藏","uni-fav.collected":"已收藏"},"zh-Hant":{"uni-fav.collect":"收藏","uni-fav.collected":"已收藏"}},{t:b}=e(y);const m=c({name:"UniFav",emits:["click"],props:{star:{type:[Boolean,String],default:!0},bgColor:{type:String,default:"#eeeeee"},fgColor:{type:String,default:"#666666"},bgColorChecked:{type:String,default:"#007aff"},fgColorChecked:{type:String,default:"#FFFFFF"},circle:{type:[Boolean,String],default:!1},checked:{type:Boolean,default:!1},contentText:{type:Object,default:()=>({contentDefault:"",contentFav:""})},stat:{type:Boolean,default:!1}},computed:{contentDefault(){return this.contentText.contentDefault||b("uni-fav.collect")},contentFav(){return this.contentText.contentFav||b("uni-fav.collected")}},watch:{checked(){uni.report&&this.stat&&(this.checked?uni.report("收藏","收藏"):uni.report("取消收藏","取消收藏"))}},methods:{onClick(){this.$emit("click")}}},[["render",function(e,c,C,p,g,y){const b=t(o("uni-icons"),l),m=h,_=v;return a(),n(_,{class:k([[!0===C.circle||"true"===C.circle?"uni-fav--circle":""],"uni-fav"]),style:s([{backgroundColor:C.checked?C.bgColorChecked:C.bgColor}]),onClick:y.onClick},{default:i((()=>[C.checked||!0!==C.star&&"true"!==C.star?f("",!0):(a(),n(b,{key:0,color:C.fgColor,style:s({color:C.checked?C.fgColorChecked:C.fgColor}),class:"uni-fav-star",size:"14",type:"star-filled"},null,8,["color","style"])),r(m,{style:s({color:C.checked?C.fgColorChecked:C.fgColor}),class:"uni-fav-text"},{default:i((()=>[d(u(C.checked?y.contentFav:y.contentDefault),1)])),_:1},8,["style"])])),_:1},8,["class","style","onClick"])}],["__scopeId","data-v-fb9316f5"]]);const _=c({components:{},data:()=>({checkList:[!1,!1,!1,!1,!1,!1],contentText:{contentDefault:"追番",contentFav:"已追番"}}),methods:{favClick(e){this.checkList[e]=!this.checkList[e],console.log(this.checkList[e]),this.$forceUpdate()}}},[["render",function(e,c,l,s,f,u){const k=h,y=t(o("uni-card"),C),b=t(o("uni-fav"),m),_=v,F=t(o("uni-section"),p),x=t(o("uni-nav-bar"),g);return a(),n(_,{class:"container"},{default:i((()=>[r(y,{"is-full":"","is-shadow":!1},{default:i((()=>[r(k,{class:"uni-h6"},{default:i((()=>[d("用于收藏功能，可点击切换选中、不选中的状态。")])),_:1})])),_:1}),r(F,{title:"基本用法",type:"line"},{default:i((()=>[r(_,{class:"example-body"},{default:i((()=>[r(b,{checked:f.checkList[0],class:"favBtn",onClick:c[0]||(c[0]=e=>u.favClick(0))},null,8,["checked"]),r(b,{checked:f.checkList[1],star:!1,class:"favBtn",onClick:c[1]||(c[1]=e=>u.favClick(1))},null,8,["checked"]),r(b,{checked:f.checkList[2],class:"favBtn",circle:!0,"bg-color":"#dd524d","bg-color-checked":"#007aff","fg-color":"#ffffff","fg-color-checked":"#ffffff",onClick:c[2]||(c[2]=e=>u.favClick(2))},null,8,["checked"]),r(b,{checked:f.checkList[3],class:"favBtn","bg-color":"#f8f8f8","bg-color-checked":"#eeeeee","fg-color":"#333333","fg-color-checked":"#333333",onClick:c[3]||(c[3]=e=>u.favClick(3))},null,8,["checked"])])),_:1})])),_:1}),r(F,{title:"自定义文字",type:"line"},{default:i((()=>[r(_,{class:"example-body"},{default:i((()=>[r(b,{checked:f.checkList[4],"content-text":f.contentText,onClick:c[4]||(c[4]=e=>u.favClick(4))},null,8,["checked","content-text"])])),_:1})])),_:1}),r(F,{title:"在自定义导航栏使用",type:"line"},{default:i((()=>[r(x,{style:{width:"100%"},fixed:!1,"left-icon":"arrowleft",title:"标题",color:"#333333","background-color":"#FFFFFF"},{right:i((()=>[r(b,{checked:f.checkList[5],circle:!0,onClick:c[5]||(c[5]=e=>u.favClick(5))},null,8,["checked"])])),_:1})])),_:1}),r(_,{class:"example-body example-body-fullWidth"})])),_:1})}],["__scopeId","data-v-cb1b2f2a"]]);export{_ as default};
