Merge pull request #4 from qburst/#5336-fix-inputotp-length-not-working
Fix #5336: InputOtp Length not workingpull/5383/head
commit
6cbf7828f1
|
@ -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) {
|
||||||
|
@ -167,7 +174,9 @@ export default {
|
||||||
if (this.integerOnly && !(event.keyCode >= 48 && event.keyCode <= 57)) {
|
if (this.integerOnly && !(event.keyCode >= 48 && event.keyCode <= 57)) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
|
if (limitReached && event.keyCode != 46) {
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue