Refactor #5336
parent
6802912517
commit
65b160d8ff
|
@ -130,12 +130,6 @@ export default {
|
||||||
},
|
},
|
||||||
onKeyDown(event) {
|
onKeyDown(event) {
|
||||||
const newValue = this.tokens.join('');
|
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) {
|
||||||
|
@ -171,11 +165,7 @@ export default {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (this.integerOnly && !(event.keyCode >= 48 && event.keyCode <= 57)) {
|
if ((this.integerOnly && !(event.keyCode >= 48 && event.keyCode <= 57)) || (this.tokens.join('').length >= this.length && event.keyCode != 46)) {
|
||||||
event.preventDefault();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (limitReached && event.keyCode != 46) {
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue