Petro Gromovo
Petro Gromovo

Reputation: 2245

Which is valid format of :only-countries using VuePhoneNumberInput?

Which is valid format of :only-countries using VuePhoneNumberInput ? I try :

<VuePhoneNumberInput
        v-model="profileRow.phone"
        @update="onUpdate"
        :only-countries="[ 'es', 'en', 'us' ]"
/>

and got console error :

[Vue warn]: Error in nextTick: "Error: Key is undefined on item (keyField is 'null')"

found in

---> <RecycleScroller>
       <CountrySelector>
         <MazPhoneNumberInput>

Looking into source files I tried:

<VuePhoneNumberInput
        v-model="profileRow.phone"
        @update="onUpdate"
        :only-countries="[ ['Afghanistan', 'af', '93'], ['Albania', 'al', '355'] ]"
/>

but got the same error.

"vue": "^2.6.11",
"vue-phone-number-input": "^1.1.9",

Thanks!

Upvotes: 1

Views: 358

Answers (1)

palaѕн
palaѕн

Reputation: 73926

Instead of using lower case ISO2 country codes, you need to use all caps code like:

:only-countries="[ 'ES', 'US', 'AF', 'AL' ]"

Also, please verify for which country en is the code, If you meant to use the country code for "Great Britain", then you will need to use GB instead.

Upvotes: 2

Related Questions