Google Places自动完成中的更改选项

Lee*_*iss 5 google-maps

我正在使用Google Maps API V3。以下是我要设置的自动完成代码:

var options = {
        componentRestrictions: {country: elmts.rs_country.val()}
 };
new google.maps.places.Autocomplete(start_address, options);
Run Code Online (Sandbox Code Playgroud)

这样很好。但是,我需要动态更改国家/地区限制。

如何将“ componentRestrictions”更改为另一个国家?

Alk*_*ris 4

请参阅此Google 地图 api。你可以使用该方法setComponentRestrictions