Commit 82636f7ab8de932e20797ae58a26532fec3740d2
Committed by
GitHub
Merge pull request #2420 from SergioCrisostomo/input-number-fixes
fix checking when temp number is invalid
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 | ... | ... |