Google 地点自动完成国家限制
Google Places Autocomplete country restriction
有没有办法让 Google 地点自动完成仅限于像法国这样的一个国家?
我有这个:components=country:fr
https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=true&libraries=places&language=fr&components=country:fr&key=API_KEY
但这并没有限制自动完成。
这段代码适合我。
var input = document.getElementById('city_field');
var options = {
types: ['(cities)'],
componentRestrictions: {country: countryCode},
language: "en"
};
autocomplete = new google.maps.places.Autocomplete(input, options);
仔细检查参数名称 components=country:fr 语法
有没有办法让 Google 地点自动完成仅限于像法国这样的一个国家?
我有这个:components=country:fr
https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=true&libraries=places&language=fr&components=country:fr&key=API_KEY
但这并没有限制自动完成。
这段代码适合我。
var input = document.getElementById('city_field');
var options = {
types: ['(cities)'],
componentRestrictions: {country: countryCode},
language: "en"
};
autocomplete = new google.maps.places.Autocomplete(input, options);
仔细检查参数名称 components=country:fr 语法