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

autoDefaultCountry overrides country

Open NaifuKishi opened this issue 2 years ago • 3 comments

Using version 5.5 with Vue v2.6.14

If autoDefaultCountry is active (default) the country of a given phone number gets overwritten. Looks like a race condition where the value gets set through the v-model and the code for checking the default country is done after that.

For example with default country Switzerland and suppling a German phone number through v-model the following happens:

  • Page is build
  • v-model gets set
  • German phone number is recognized and German flag shown
  • Swiss flag shows after a short while and +49 on phone number gets replaced by +41

Switching autoDefaultCountry off through the options fixes the problem. However then the default country is set to Afghanistan.

Using the following options works as intended:

autoDefaultCountry: false defaultCountry: "CH"

NaifuKishi avatar Jul 19 '21 14:07 NaifuKishi

+1 this problem in Vue project "vue-tel-input": "^5.6.2",

Velmoren avatar Sep 03 '21 12:09 Velmoren

+1. @iamstevendao can we get a response about this issue? Looks pretty important

Lezhni avatar Sep 03 '21 12:09 Lezhni