vue-tel-input icon indicating copy to clipboard operation
vue-tel-input copied to clipboard

Emitting input on mount

Open henningsover opened this issue 4 years ago • 2 comments

I ran into a bug where my form validator (VeeValidate) picked up an input event just by mounting a form, which I thought was strange. I then discovered that the event is emitted when VueTelInput mounts. After reading the source code I'm pretty sure it happens when VueTelInput initialize what country to use ( initializeCountry() ). I get that this should be done when changing the country manually with the select element, but shouldn't this be avoided during the initial mount? Or am I doing something wrong?

henningsover avatar Feb 09 '22 16:02 henningsover

Try to use <vue-tel-input :value="value"> instead of <vue-tel-input v-model="value">

Check: https://v2.vuejs.org/v2/guide/forms.html

v-model internally uses different properties and emits different events for different input elements: text and textarea elements use value property and input event;

msprogramando avatar Jun 20 '22 13:06 msprogramando

try to await while initialization completes. it takes less than a second

<vue-tel-input v-model="value">

let self = this; setTimeout(function(){ self.value = '+7 701 377 7200'; }, 1000);

sayat2002 avatar Sep 22 '22 09:09 sayat2002