html <el-button type=“primary” class=“code-but” @click=‘code’ :disabled=“codeDisabled” > {{codeMsg}} ![请添加图片描述](https://img-blog.csdnimg.cn/968032c7ef3d4fbba2e9bcda77bde0c6.png) 在data中定义 ![请添加图片描述](https://img-blog.csdnimg.cn/9b3dd6eaaf364df38f84bb8da692d976.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBA5pCs56CW55qE5LiA5ZGY,size_20,color_FFFFFF,t_70,g_se,x_16) js ![请添加图片描述](https://img-blog.csdnimg.cn/bc4c020b4afe4004841cc7eba6c2d7d7.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBA5pCs56CW55qE5LiA5ZGY,size_20,color_FFFFFF,t_70,g_se,x_16) 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); } } });
|