2016-11-06 92 views

回答

0

尝试

componentRestrictions: {country: "2 character code"} 

var options = { 
    types: ['(cities)'], //types: ['(regions)'] if you want to show all regions in country 
    componentRestrictions: {country: "hu"} 
}; 

var input = document.getElementById('searchTextField'); 
var autocomplete = new google.maps.places.Autocomplete(input, options); 

参考https://developers.google.com/maps/documentation/javascript/places-autocomplete了解更多

+0

谢谢!它'有效,但只显示城市。如何显示城市+州(县)? –

+0

使用类型:['(regions)']并尝试 –

+0

谢谢!它工作 –

相关问题