Created
June 29, 2020 05:18
-
-
Save stefango/9cc47764134d9b00894cbe78afb8596e to your computer and use it in GitHub Desktop.
获取验证码片段
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getCode() { | |
this.isLoading = true | |
this.isDisable = true | |
let time = 10; | |
this.getCodeButtonValue = time + '秒后重试' | |
let task = setInterval(() => { | |
time--; | |
this.getCodeButtonValue = time + '秒后重试' | |
console.log("task - " + time) | |
}, 1000) | |
setTimeout(() => { | |
this.isLoading = false | |
this.isDisable = false | |
this.getCodeButtonValue = '获取验证码' | |
clearInterval(task) | |
console.log('timeout') | |
}, 10 * 1000) | |
console.log('END') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment