cashier-mer/dist/assets/authCode-DA-pJ64X.js

2 lines
853 B
JavaScript
Raw Permalink Normal View History

2024-06-29 18:29:14 +08:00
import{r as n,b as r,c,d as m,w as y,g as f,t as p,K as v}from"./index-QWlmoZOY.js";const w={__name:"authCode",props:{type:{type:String,default:"primary"},start:{type:Boolean,default:!0},time:{type:Number,default:60},text:{type:String,default:"发送验证码"},timeText:{type:String,default:"秒重新获取"},width:{type:String,default:"100px"},disabled:{type:Boolean,default:!1}},emits:["sendCode"],setup(t,{emit:o}){const a=t,s=o,i=()=>{s("sendCode"),a.start&&d()},e=n(0),l=n(null),d=()=>{e.value=a.time,l.value=setInterval(()=>{e.value--,e.value<=0&&(clearInterval(l.value),e.value=0)},1e3)};return(x,b)=>{const u=r("el-button");return c(),m(u,{type:t.type,style:v({width:t.width}),onClick:i,disabled:e.value>0||t.disabled},{default:y(()=>[f(p(e.value>0?`${e.value}${t.timeText}`:t.text),1)]),_:1},8,["type","style","disabled"])}}};export{w as _};