Fix #5336: InputOtp Length not working

pull/5383/head
Amal Mathew 2024-03-07 10:33:38 +05:30
parent d7c25df7b0
commit 33b9a1ba1f
1 changed files with 10 additions and 1 deletions

View File

@ -129,6 +129,13 @@ export default {
this.$emit('blur', event);
},
onKeyDown(event) {
const newValue = this.tokens.join('');
let limitReached = false;
if (newValue.length >= this.length) {
limitReached = true;
}
const keyCode = event.keyCode;
switch (keyCode) {
@ -167,7 +174,9 @@ export default {
if (this.integerOnly && !(event.keyCode >= 48 && event.keyCode <= 57)) {
event.preventDefault();
}
if (limitReached && event.keyCode != 46) {
event.preventDefault();
}
break;
}
},