【发布时间】:2016-04-02 20:32:57
【问题描述】:
我正在使用 Google 地图的 Places API 作为用户类型自动完成位置。但是如何将建议限制在特定国家/地区?
这是我的 javascript:
function initAutocomplete() {
// Create the search box and link it to the UI element.
var input = document.getElementById('autocomplete-input');
var searchBox = new google.maps.places.SearchBox(input);
// [START region_getplaces]
// Listen for the event fired when the user selects a prediction and retrieve
// more details for that place.
searchBox.addListener('places_changed', function() {
var places = searchBox.getPlaces();
if (places.length == 0) {
return;
}
});
}
【问题讨论】:
标签: javascript google-maps google-maps-api-3