Skip to content

Commit 16c1dd6

Browse files
committed
Fix bug flag shows country not included in only-countries prop #166
1 parent 5039839 commit 16c1dd6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/components/vue-tel-input.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,9 @@ export default {
268268
filteredCountries() {
269269
// List countries after filtered
270270
if (this.onlyCountries.length) {
271-
return this.getCountries(this.onlyCountries);
271+
return this.onlyCountries
272+
.map((iso) => this.allCountries.find((c) => c.iso2 === iso.toUpperCase()))
273+
.filter(Boolean);
272274
}
273275
274276
if (this.ignoredCountries.length) {
@@ -433,7 +435,7 @@ export default {
433435
.filter(Boolean);
434436
},
435437
findCountry(iso = '') {
436-
return this.allCountries.find((country) => country.iso2 === iso.toUpperCase());
438+
return this.filteredCountries.find((country) => country.iso2 === iso.toUpperCase());
437439
},
438440
getItemClass(index, iso2) {
439441
const highlighted = this.selectedIndex === index;

0 commit comments

Comments
 (0)