fix checking when temp number is invalid and should be rechecked in "change" event
This commit is contained in:
parent
d291e8152b
commit
a14d6dd2e4
1 changed files with 5 additions and 1 deletions
|
@ -258,11 +258,15 @@
|
||||||
let val = event.target.value.trim();
|
let val = event.target.value.trim();
|
||||||
|
|
||||||
if (event.type == 'input' && val.match(/^\-?\.?$|\.$/)) return; // prevent fire early if decimal. If no more input the change event will fire later
|
if (event.type == 'input' && val.match(/^\-?\.?$|\.$/)) return; // prevent fire early if decimal. If no more input the change event will fire later
|
||||||
if (event.type == 'change' && Number(val) === this.currentValue) return; // already fired change for input event
|
|
||||||
|
|
||||||
const {min, max} = this;
|
const {min, max} = this;
|
||||||
const isEmptyString = val.length === 0;
|
const isEmptyString = val.length === 0;
|
||||||
val = Number(val);
|
val = Number(val);
|
||||||
|
|
||||||
|
if (event.type == 'change'){
|
||||||
|
if (val === this.currentValue && val > min && val < max) return; // already fired change for input event
|
||||||
|
}
|
||||||
|
|
||||||
if (!isNaN(val) && !isEmptyString) {
|
if (!isNaN(val) && !isEmptyString) {
|
||||||
this.currentValue = val;
|
this.currentValue = val;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue