Merge pull request #5383 from qburst/master

Fix #5336: InputOtp Length not working
pull/5414/head
Tuğçe Küçükoğlu 2024-03-13 15:50:28 +03:00 committed by GitHub
commit 6802912517
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 11 additions and 0 deletions

View File

@ -129,6 +129,13 @@ export default {
this.$emit('blur', event); this.$emit('blur', event);
}, },
onKeyDown(event) { onKeyDown(event) {
const newValue = this.tokens.join('');
let limitReached = false;
if (newValue.length >= this.length) {
limitReached = true;
}
const keyCode = event.keyCode; const keyCode = event.keyCode;
switch (keyCode) { switch (keyCode) {
@ -168,6 +175,10 @@ export default {
event.preventDefault(); event.preventDefault();
} }
if (limitReached && event.keyCode != 46) {
event.preventDefault();
}
break; break;
} }
}, },