相关疑难解决方法(0)

只允许各国从Google Maps API自动填充

我正在使用Google Maps API获取城市和国家/地区的自动填充列表(没有其他详细信息),而且效果很好.

var input = document.getElementById('newAddress');
    var options = {
        types: ['(cities)']
    };

    autocomplete = new google.maps.places.Autocomplete(input, options);
Run Code Online (Sandbox Code Playgroud)

现在我想完全相同,但只获得国家名称.像财产以后更换types: ['(cities)']types: ['(countries)']...
(我试过,但没有工作)

我应该怎么做才能让国家/地区进入我的自动填充功能?

javascript google-maps google-maps-api-3

13
推荐指数
2
解决办法
3万
查看次数