2015-11-02 76 views
1

是否可以過濾1個以上的國家?Google autocomplete限制超過1個國家

我嘗試這樣做:

componentRestrictions: {country: "us","uk"} 

但didnt工作。

完整代碼:

<script src="http://maps.googleapis.com/maps/api/js?sensor=false&amp;libraries=places" type="text/javascript"></script> 
<script type="text/javascript"> 
    function initialize() { 
     var options = { 
    types: ['(cities)'], 
    componentRestrictions: {country: "us","uk"} 
}; 

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

} 

    google.maps.event.addDomListener(window, 'load', initialize); 
</script> 

回答

0
componentRestrictions: {country: "us", country: "ca"} 

其作品般的魅力:)

+0

我沒有工作,它只是需要最後一個國家 – simplesystems