example(captcha): fix demo verify captcha too fast

This commit is contained in:
supergaojian 2018-12-17 10:52:42 +08:00
parent 68fac32005
commit f5fccb25d8
1 changed files with 11 additions and 9 deletions

View File

@ -101,16 +101,18 @@ export default {
},
submit(val) {
const max = parseFloat(this.maxlength)
if (!this.limit || max < 0 || val.length === max) {
if (val !== '1234') {
this.$refs.captcha.setError('验证码错误,请重新输入')
} else {
this.show = false
Toast({
content: `你输入了${val}`,
})
setTimeout(() => {
if (!this.limit || max < 0 || val.length === max) {
if (val !== '1234') {
this.$refs.captcha.setError('验证码错误,请重新输入')
} else {
this.show = false
Toast({
content: `你输入了${val}`,
})
}
}
}
}, 300)
},
onSend() {
console.log('click resend button.')