需求:输入手机号 -> 点击获取验证码 -> 进入60s倒计时
短信验证码登录
data: { seconds: 0, // 读秒 timer: '' // 计时器 },
let that = this // 开始倒计时 that.setData({ seconds: 60, timer: setInterval(function(){ let seconds = that.data.seconds that.setData({ seconds: seconds - 1 }) if (that.data.seconds == 0) { // 读秒结束 清空计时器 clearInterval(that.data.timer) } }, 1000) })
作者:一本大书
链接:https://www.jianshu.com/p/e2c8d10f965b
点击查看更多内容
为 TA 点赞
评论
共同学习,写下你的评论
评论加载中...
作者其他优质文章
正在加载中
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦