Commit 85ed4df8fc1e10e9260bcc9cf11cbba06444638a
1 parent
bf9649f6
fixed Input bug
when use input prop in Input, it can not correctly to emit a Number value
Showing
1 changed file
with
2 additions
and
1 deletions
Show diff stats
src/components/input/input.vue
| ... | ... | @@ -157,7 +157,8 @@ |
| 157 | 157 | } |
| 158 | 158 | }, |
| 159 | 159 | handleInput (event) { |
| 160 | - const value = event.target.value; | |
| 160 | + let value = event.target.value; | |
| 161 | + if (this.number) value = Number.isNaN(Number(value)) ? value : Number(value); | |
| 161 | 162 | this.$emit('input', value); |
| 162 | 163 | this.setCurrentValue(value); |
| 163 | 164 | this.$emit('on-change', event); | ... | ... |