Skip to content

Commit ff96531

Browse files
authored
Merge pull request #120 from mozzi/countries-as-property
make allCountries a property
2 parents a4cef9b + 3c7e1d2 commit ff96531

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/vue-tel-input.vue

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,10 @@ export default {
229229
type: Boolean,
230230
default: false,
231231
},
232+
allCountries: {
233+
type: Array,
234+
default: () => allCountries,
235+
},
232236
defaultCountry: {
233237
// Default country code, ie: 'AU'
234238
// Will override the current country of user
@@ -322,11 +326,11 @@ export default {
322326
}
323327
324328
if (this.ignoredCountries.length) {
325-
return allCountries.filter(({ iso2 }) => !this.ignoredCountries.includes(iso2.toUpperCase())
329+
return this.allCountries.filter(({ iso2 }) => !this.ignoredCountries.includes(iso2.toUpperCase())
326330
&& !this.ignoredCountries.includes(iso2.toLowerCase()));
327331
}
328332
329-
return allCountries;
333+
return this.allCountries;
330334
},
331335
sortedCountries() {
332336
// Sort the list countries: from preferred countries to all countries
@@ -482,7 +486,7 @@ export default {
482486
.filter(Boolean);
483487
},
484488
findCountry(iso = '') {
485-
return allCountries.find(country => country.iso2 === iso.toUpperCase());
489+
return this.allCountries.find(country => country.iso2 === iso.toUpperCase());
486490
},
487491
getItemClass(index, iso2) {
488492
const highlighted = this.selectedIndex === index;

0 commit comments

Comments
 (0)