Skip to content

Commit 5c56199

Browse files
committed
fix reverse fill issue
1 parent 5c9fe1e commit 5c56199

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

docs/src/App.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<template>
2-
<vue-number v-bind="config" v-model="price" />
2+
<div>
3+
<vue-number v-bind="config" v-model="price" />
4+
{{ price }}
5+
</div>
36
</template>
47

58
<script>
@@ -10,6 +13,7 @@ export default {
1013
config: {
1114
prefix: '$',
1215
// min: 0,
16+
reverseFill: true
1317
}
1418
}
1519
},

src/number-format.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,10 @@ export default class NumberFormat {
163163
*/
164164
unformat(input: Input): string {
165165
this.input = input
166-
if (this.isNull() && !this.options.reverseFill) {
166+
if (this.isNull()) {
167+
return this.options.nullValue
168+
}
169+
if (this.options.reverseFill && this.realNumber() <= 0) {
167170
return this.options.nullValue
168171
}
169172
return this.sign() + this.realNumber()

0 commit comments

Comments
 (0)