Commit a14d6dd2e4d1b20f69989bd8099996d6ffc2e951

Authored by Sergio Crisostomo
1 parent d291e815

fix checking when temp number is invalid and should be rechecked in "change" event

Showing 1 changed file with 5 additions and 1 deletions   Show diff stats
src/components/input-number/input-number.vue
... ... @@ -258,11 +258,15 @@
258 258 let val = event.target.value.trim();
259 259  
260 260 if (event.type == 'input' && val.match(/^\-?\.?$|\.$/)) return; // prevent fire early if decimal. If no more input the change event will fire later
261   - if (event.type == 'change' && Number(val) === this.currentValue) return; // already fired change for input event
262 261  
263 262 const {min, max} = this;
264 263 const isEmptyString = val.length === 0;
265 264 val = Number(val);
  265 +
  266 + if (event.type == 'change'){
  267 + if (val === this.currentValue && val > min && val < max) return; // already fired change for input event
  268 + }
  269 +
266 270 if (!isNaN(val) && !isEmptyString) {
267 271 this.currentValue = val;
268 272  
... ...