Google地方信息自动填充需要多个国家/地区组件限制 [英] Need multiple country componentRestrictions in Google Places Autocomplete
问题描述
我需要Google Places Autocomplete向我提供国家/地区的结果:SZ,FR,DE,AT和IT。我知道 componentRestrictions
只能在一个国家运作。
那么,有没有办法在Google Places自动完成中获得多个县的结果?
I need Google Places Autocomplete to give me results from countries: SZ, FR, DE, AT, IT. I know that componentRestrictions
can operate with only one country.
So, is there a way to get results with multiple counties in Google Places Autocomplete?
我的页面是从放置自动填充地址表单示例:
推荐答案
此功能是2017年1月发布的Maps JavaScript API 3.27版本中引入的: $ b
This feature was introduced in version 3.27 of Maps JavaScript API in January 2017:
您现在可以将自动填充预测限制为仅来自多个国家/地区。您可以通过在AutocompleteOptions的componentRestrictions字段中指定多达5个国家/地区来完成此操作。
You can now restrict Autocomplete predictions to only surface from multiple countries. You can do this by specifying up to 5 countries in the componentRestrictions field of the AutocompleteOptions.
https://developers.google.com/maps/documentation/javascript/releases#327
这篇关于Google地方信息自动填充需要多个国家/地区组件限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!