這篇文章主要介紹了微信小程序驗證碼如何獲取倒計時效果,具有一定借鑒價值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。
wxml
js
var interval = null //倒計時函數(shù) Page({ data: { date:'請選擇日期', fun_id:2, time: '獲取驗證碼', //倒計時 currentTime:61 }, getCode: function (options){ var that = this; var currentTime = that.data.currentTime interval = setInterval(function () { currentTime--; that.setData({ time: currentTime+'秒' }) if (currentTime <= 0) { clearInterval(interval) that.setData({ time: '重新發(fā)送', currentTime:61, disabled: false }) } }, 100) }, getVerificationCode(){ this.getCode(); var that = this that.setData({ disabled:true }) }, })
感謝你能夠認真閱讀完這篇文章,希望小編分享的“微信小程序驗證碼如何獲取倒計時效果”這篇文章對大家有幫助,同時也希望大家多多支持創(chuàng)新互聯(lián)網(wǎng)站建設公司,,關注創(chuàng)新互聯(lián)行業(yè)資訊頻道,更多相關知識等著你來學習!