Skip to content

Commit

Permalink
Fix bug flag shows country not included in only-countries prop #166
Browse files Browse the repository at this point in the history
  • Loading branch information
iamstevendao committed Mar 22, 2020
1 parent 5039839 commit 16c1dd6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/vue-tel-input.vue
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,9 @@ export default {
filteredCountries() {
// List countries after filtered
if (this.onlyCountries.length) {
return this.getCountries(this.onlyCountries);
return this.onlyCountries
.map((iso) => this.allCountries.find((c) => c.iso2 === iso.toUpperCase()))
.filter(Boolean);
}
if (this.ignoredCountries.length) {
Expand Down Expand Up @@ -433,7 +435,7 @@ export default {
.filter(Boolean);
},
findCountry(iso = '') {
return this.allCountries.find((country) => country.iso2 === iso.toUpperCase());
return this.filteredCountries.find((country) => country.iso2 === iso.toUpperCase());
},
getItemClass(index, iso2) {
const highlighted = this.selectedIndex === index;
Expand Down

0 comments on commit 16c1dd6

Please sign in to comment.