Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions src/vue-numeric.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@focus="onFocusHandler"
ref="numeric"
type="tel"
v-model="amount"
:value="amount"
v-if="!readOnly"
>
<span
Expand Down Expand Up @@ -68,7 +68,7 @@ export default {
},

/**
* Value when the input is empty
* Value when the input is empty.
*/
emptyValue: {
type: [Number, String],
Expand Down Expand Up @@ -161,6 +161,15 @@ export default {
type: String,
default: 'prefix',
required: false
},

/**
* Function to process input value before format.
*/
inputFilter: {
type: Function,
default: null,
required: false,
}
},

Expand Down Expand Up @@ -314,7 +323,9 @@ export default {
/**
* Handle input event.
*/
onInputHandler () {
onInputHandler (e) {
this.amount = this.inputFilter instanceof Function && this.inputFilter
? this.inputFilter(e.target.value) : e.target.value
this.process(this.amountNumber)
},

Expand Down