Skip to content

Commit 8b3bb6c

Browse files
committed
fix decimal operator to show correctly on focus
1 parent 2e54d59 commit 8b3bb6c

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

docs/build.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-numeric",
3-
"version": "1.4.1",
3+
"version": "1.4.2",
44
"description": "Input field component to display currency value based on Vue.",
55
"author": "Kevin Ongko",
66
"main": "src/vue-numeric.vue",

src/vue-numeric.vue

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
:value="value"
55
@blur="formatValue(amountValue)"
66
@input="processValue(amountValue)"
7-
@focus="convertValueToNumberType"
7+
@focus="convertToNumber"
88
ref="numeric"
99
type="tel"
1010
v-model="amount"
@@ -240,8 +240,13 @@ export default {
240240
/**
241241
* Remove symbol and separator on focus.
242242
*/
243-
convertValueToNumberType () {
244-
this.amount = this.value
243+
convertToNumber () {
244+
this.amount = accounting.formatMoney(this.value, {
245+
symbol: '',
246+
precision: Number(this.precision),
247+
decimal: this.decimalSeparator,
248+
thousand: ''
249+
})
245250
}
246251
},
247252

0 commit comments

Comments
 (0)