html <el-button type=“primary” class=“code-but” @click=‘code’ :disabled=“codeDisabled” > {{codeMsg}} 在data中定义 js code() { this.KaTeX parse error: Expected '}', got 'EOF' at end of input: …} = await this.axios.get(’/login/authCode’, { params: { phone: this.loginForm.phone }, }); window.console.log(res); if (res.code !== 200) { this.KaTeX parse error: Expected 'EOF', got '}' at position 33: ….msg); }? else { …message.success(‘获取验证码成功’); // 获取验证码倒计时 if (!this.timer) { this.timer = setInterval(() => { if (this.countdown > 0 && this.countdown <= 60) { this.countdown -= 1; this.codeDisabled = true; if (this.countdown !== 0) { const codeMsgs = ‘重新获取’; this.codeMsg = codeMsgs.concat(this.countdown, ‘s’); } else { clearInterval(this.timer); this.codeMsg = ‘获取验证码’; this.countdown = 60; this.timer = null; this.codeDisabled = false; } } }, 1000); } } });
|