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
1.3 KiB
2 lines
1.3 KiB
var i=(t,a,e)=>new Promise((u,s)=>{var l=n=>{try{c(e.next(n))}catch(o){s(o)}},r=n=>{try{c(e.throw(n))}catch(o){s(o)}},c=n=>n.done?u(n.value):Promise.resolve(n.value).then(l,r);c((e=e.apply(t,a)).next())});import{d as f,B as p,r as m,f as B,u as d,G as S,e as g,aj as y,aT as C,aU as b,o as w,a as h,w as v,h as T,t as _,aP as $}from"./index-f4658ae7.js";import{useCountdown as k}from"./useCountdown-be79a558.js";const x={value:{type:[Object,Number,String,Array]},count:{type:Number,default:60},beforeStartFunc:{type:Function,default:null}},F=f({name:"CountButton",components:{Button:p},props:x,setup(t){const a=m(!1),{currentCount:e,isStart:u,start:s,reset:l}=k(t.count),{t:r}=g(),c=B(()=>d(u)?r("component.countdown.sendText",[d(e)]):r("component.countdown.normalText"));S(()=>{t.value===void 0&&l()});function n(){return i(this,null,function*(){const{beforeStartFunc:o}=t;if(o&&y(o)){a.value=!0;try{(yield o())&&s()}finally{a.value=!1}}else s()})}return{handleStart:n,currentCount:e,loading:a,getButtonText:c,isStart:u}}});function N(t,a,e,u,s,l){const r=b("Button");return w(),h(r,$(t.$attrs,{disabled:t.isStart,onClick:t.handleStart,loading:t.loading}),{default:v(()=>[T(_(t.getButtonText),1)]),_:1},16,["disabled","onClick","loading"])}const E=C(F,[["render",N]]);export{E as default};
|