这篇文章主要为大家详细介绍了微信小程序实现验证码获取倒计时效果,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
本文实例为大家分享了微信小程序实现获取验证码倒计时效果的具体代码,供大家参考,具体内容如下

wxml
<button>
{{time}}
</button>
js
var interval = null //倒计时函数
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 <p>上面是我整理给大家的,希望今后会对大家有帮助。</p><p>相关文章:</p><p><a href="http://www.php.cn/js-tutorial-401241247.html" target="_blank">webpack 4.0.0-beta.0版本新特性(详细教程)</a></p><p><a href="http://www.php.cn/js-tutorial-401241243.html" target="_blank">在vue2.0组件中如何实现传值、通信</a></p><p><a href="http://www.php.cn/js-tutorial-401233.html" target="_blank">在vue.js中实现分页中单击页码更换页面内容</a></p>










