Open ryanmwc opened 4 years ago
In vue-place-autocomplete/src/PlaceAutocompleteField.vue line 306 is:
// can be used to restrict results to specific groups. Currently, you can use componentRestrictions to filter by up to 5 countries. Countries must be passed as as a two-character, ISO 3166-1 Alpha-2 compatible country code. Multiple countries must be passed as a list of country codes. z
componentRestrictions: undefined,
Unfortunetly I do not know how to use this.
This should works:
<place-autocomplete-field
:api-key="**********"
:component-restrictions='{country: ["us", "de"]}'
></place-autocomplete-field >
This should works:
<place-autocomplete-field :api-key="**********" :component-restrictions='{country: ["us", "de"]}' ></place-autocomplete-field >
This doesn't seem to work for me at all, I can see the restrictions being applied to the component but it is still not filtering the results
Do you have any workaround to filter the results by country ? Also, is there any plan to get same feature to filter zipCode or City ?
Anyone found a solution to this yet?
:component-restrictions='{country: ["AT", "de", "ch", "it"]}'
:libraries="['geometry', 'places', '&language=at®ion=AT']"
Doing this will not restrict to these country's. I add a region
in libraries and the result will now prioritized to the country's within component-restrictions
.
Not the best solution but can used till this will fixed.
🥳 Using the suggested solution by @CSalih worked great for me. I needed to restrict to addresses in Australia, with the following:
:component-restrictions='{country: ["AU"]}'
:libraries="['geometry', 'places', '&language=EN®ion=AU']"
I don't see anywhere in your docs on how to filter results by country. Do you not have this set up as a prop?