小程序
小游戏
企业微信
微信支付
扫描小程序码分享
https://developers.weixin.qq.com/s/paWbsomw7hAp本来应该到0就不会再减了 一直减0 -1 -2 持续下去
1 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
isDisabled: false, countDownNum: 60, // 倒计时初始值 timer: "" var countDownNum = _this.data.countDownNum // 获取倒计时初始值 _this.data.timer = setInterval(function () { countDownNum -= 1 _this.setData({ countDownNum: countDownNum, isDisabled: true }) if (countDownNum <= -1) { clearInterval(_this.data.timer) // 取消置顶的setInterval函数将要执行的代码 _this.setData({ countDownNum: 60, isDisabled: false }) } }, 1000)
<block wx:if="{{countDownNum == 60 || countDownNum == -1}}">
<van-button bindtap="getCode" slot="button" size="small" style="margin-top: 15rpx;display: inline-block;margin-left: 30rpx;" custom-style="border-radius: 14rpx;width:200rpx;height:60rpx;margin-bottom:20rpx;">
获取验证码
</van-button>
</block>
<!-- 60s之后可重新获取验证码 -->
<block wx:else>
<van-button disabled='{{isDisabled}}' style="margin-top: 15rpx;display: inline-block;margin-left: 30rpx;" custom-style="border-radius: 14rpx;width:200rpx;height:60rpx;margin-bottom:20rpx;" slot="button" size="small">
<view class='yanzen-row'>
<view class='time'>{{countDownNum}}</view>
<view class="smiao">s后重新发送</view>
</view>
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
isDisabled: false, countDownNum: 60, // 倒计时初始值 timer: "" var countDownNum = _this.data.countDownNum // 获取倒计时初始值 _this.data.timer = setInterval(function () { countDownNum -= 1 _this.setData({ countDownNum: countDownNum, isDisabled: true }) if (countDownNum <= -1) { clearInterval(_this.data.timer) // 取消置顶的setInterval函数将要执行的代码 _this.setData({ countDownNum: 60, isDisabled: false }) } }, 1000)
<block wx:if="{{countDownNum == 60 || countDownNum == -1}}">
<van-button bindtap="getCode" slot="button" size="small" style="margin-top: 15rpx;display: inline-block;margin-left: 30rpx;" custom-style="border-radius: 14rpx;width:200rpx;height:60rpx;margin-bottom:20rpx;">
获取验证码
</van-button>
</block>
<!-- 60s之后可重新获取验证码 -->
<block wx:else>
<van-button disabled='{{isDisabled}}' style="margin-top: 15rpx;display: inline-block;margin-left: 30rpx;" custom-style="border-radius: 14rpx;width:200rpx;height:60rpx;margin-bottom:20rpx;" slot="button" size="small">
<view class='yanzen-row'>
<view class='time'>{{countDownNum}}</view>
<view class="smiao">s后重新发送</view>
</view>
</van-button>
</block>