Skip to content

Commit

Permalink
Fixed #453 - Can't type - as first symbol into an Inputnumber
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Aug 27, 2020
1 parent 19252e6 commit 91ebe9d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/components/inputnumber/InputNumber.vue
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ export default {
},
formatValue(value) {
if (value != null) {
if (value === '-') { // Minus sign
return value;
}
if (this.format) {
let formatter = new Intl.NumberFormat(this.locale, this.getOptions());
let formattedValue = formatter.format(value);
Expand Down Expand Up @@ -196,6 +200,9 @@ export default {
.replace(this._numeral, this._index);
if (filteredText) {
if (filteredText === '-') // Minus sign
return filteredText;
let parsedValue = +filteredText;
return isNaN(parsedValue) ? null : parsedValue;
}
Expand Down

0 comments on commit 91ebe9d

Please sign in to comment.