You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
644 B
26 lines
644 B
var length = 60;
|
|
function countdown(that) {
|
|
that.setData({
|
|
captchaDisabled: true,
|
|
captchaLabel: length + '秒后重新发送'
|
|
});
|
|
setTimeout(() => {
|
|
if (length <= 1) {
|
|
length = 60
|
|
that.setData({
|
|
captchaDisabled: false,
|
|
captchaLabel: "获取验证码"
|
|
});
|
|
return false;
|
|
} else {
|
|
length--;
|
|
that.setData({
|
|
captchaDisabled: true,
|
|
captchaLabel: length + '秒后重新发送'
|
|
});
|
|
}
|
|
countdown(that)
|
|
}, 1000)
|
|
}
|
|
module.exports = countdown
|
|
|