fix: 修复获取验证码倒计时会有 1s 延时禁用的问题

This commit is contained in:
Zamir Zhang 2023-05-15 19:42:30 +08:00 committed by GitHub
parent 7ffd7e2d7d
commit 6776e85641
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,11 +17,12 @@ export const useVerifyCode = () => {
await formEl.validateField(props, isValid => {
if (isValid) {
clearInterval(timer.value);
isDisabled.value = true;
text.value = `${time}`;
timer.value = setInterval(() => {
if (time > 0) {
text.value = `${time}`;
isDisabled.value = true;
time -= 1;
text.value = `${time}`;
} else {
text.value = "";
isDisabled.value = false;