您好,欢迎访问一九零五行业门户网

小程序:实现点击倒计时的代码

本篇文章给大家带来的内容是关于小程序:实现点击倒计时的代码,有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。
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 <= 0) { clearinterval(interval) that.setdata({ time: '重新发送', currenttime:61, disabled: false }) } }, 100) }, getverificationcode(){ this.getcode(); var that = this that.setdata({ disabled:true }) },})
<button disabled='{{disabled}}' data-id="2" bindtap="getverificationcode">{{time}}</button>
相关推荐:
小程序组件:聊天会话组件的介绍(附代码)
小程序与后台进行交互的实现(附代码)
以上就是小程序:实现点击倒计时的代码的详细内容。
其它类似信息

推荐信息