From 65b160d8ff4dbb0dd2b2af5b33eea34d900dfb7e Mon Sep 17 00:00:00 2001 From: tugcekucukoglu Date: Wed, 13 Mar 2024 15:51:15 +0300 Subject: [PATCH] Refactor #5336 --- components/lib/inputotp/InputOtp.vue | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/components/lib/inputotp/InputOtp.vue b/components/lib/inputotp/InputOtp.vue index bdeae9275..f1590c4b7 100755 --- a/components/lib/inputotp/InputOtp.vue +++ b/components/lib/inputotp/InputOtp.vue @@ -130,12 +130,6 @@ export default { }, onKeyDown(event) { const newValue = this.tokens.join(''); - let limitReached = false; - - if (newValue.length >= this.length) { - limitReached = true; - } - const keyCode = event.keyCode; switch (keyCode) { @@ -171,11 +165,7 @@ export default { break; default: - if (this.integerOnly && !(event.keyCode >= 48 && event.keyCode <= 57)) { - event.preventDefault(); - } - - if (limitReached && event.keyCode != 46) { + if ((this.integerOnly && !(event.keyCode >= 48 && event.keyCode <= 57)) || (this.tokens.join('').length >= this.length && event.keyCode != 46)) { event.preventDefault(); }