vue-tel-input
vue-tel-input copied to clipboard
ip2c fetch call sometimes fails and is unreliable
We noticed recently that the ip2c fetch call is very slow (4-5s) and can even timeout. This leads to the flag widget remaining blank and not working properly. The slow call prevents the widget from initializing correctly
Having an option to set a shorter timeout, cancelling the request when numbers are inputed or setting a default flag if the call is failing would be ideal.
@Gabcot i have the same issue and a lot of issue are open because of that... Is there a good alternative?
@dominikager We are considering creating our own ip detection on the frontend and feed the country ISO2 as a default value to override the ip2c call.
@Gabcot i added the following lines and it works
mounted() {
axios.get('http://ip-api.com/json/?fields=status,message,countryCode').then(function (payload) {
this.defaultCountry = payload.data.countryCode
})
},
<vue-tel-input
:auto-default-country="false"
:default-country="defaultCountry"
/>
@dominikager Thanks!, the answer worked for me, Only that I set default-country as a static value for my requirements.
<vue-tel-input :auto-default-country="false" default-country="MX" />
it cant be changed after it mounted..