Skip to content

Commit

Permalink
Return current input element as the third argument in @input
Browse files Browse the repository at this point in the history
  • Loading branch information
iamstevendao committed Jan 30, 2021
1 parent 1a0a7a7 commit 7bd918c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/components/vue-tel-input.vue
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ export default {
if (!this.autoFormat || this.customValidate) {
return;
}
this.$emit('input', value, this.phoneObject);
this.emitInput(value);
this.$nextTick(() => {
// In case `v-model` is not set, we need to update the `phone` to be new formatted value
Expand Down Expand Up @@ -427,7 +427,7 @@ export default {
// update value, even if international mode is NOT used
this.activeCountryCode = parsedCountry.iso2;
this.$emit('input', this.phone, this.phoneObject);
this.emitInput(this.phone);
},
cleanInvalidCharacters() {
const currentPhone = this.phone;
Expand All @@ -442,7 +442,7 @@ export default {
}
if (currentPhone !== this.phone) {
this.$emit('input', this.phone, this.phoneObject);
this.emitInput(this.phone);
}
},
testCharacters() {
Expand All @@ -465,7 +465,10 @@ export default {
// Returns response.number to assign it to v-model (if being used)
// Returns full response for cases @input is used
// and parent wants to return the whole response.
this.$emit('input', this.phone, this.phoneObject);
this.emitInput(this.phone);
},
emitInput(value) {
this.$emit('input', value, this.phoneObject, this.$refs.input);
},
onBlur() {
this.$emit('blur');
Expand Down

0 comments on commit 7bd918c

Please sign in to comment.