Skip to content

Feature/raw input callback #75

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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