倒计时
let second = 5, let timePromise = undefined; let _this = this; timePromise = setInterval(function() { if (second <= 0) { clearInterval(timePromise); second = 5; _this.setState({ codeText: '获取验证码', }); } else { _this.setState({ codeText: '重新获取(' + second + ')', }, () => { second--; }); } }, 1000);
浙公网安备 33010602011771号