google.maps api完成加载后执行某些操作

时间:2017-06-11 12:30:49

标签: jquery google-maps

我已经在我的项目中设置了一个google api自动完成功能并且工作正常,但是我已经搜索过了一些事件,当这个api在输入文本中写完一些东西后完成加载位置时,我可以做一些事情,这里有一些代码我希望它能帮助你理解我想做的事情

   function initAutocomplete() {
    // Create the autocomplete object, restricting the search to geographical
    // location types.
    autocomplete = new google.maps.places.Autocomplete(
        /** @type {!HTMLInputElement} */(document.getElementById('autocomplete')),
        {types: ['geocode']});


    // When the user selects an address from the dropdown, populate the address
    // fields in the form.
    autocomplete.addListener('place_changed', fillInAddress);
  autocomplete.addListener(map,'tilesloaded', function(){  alert('sgsg');});
  }

我使用了'tileloaded'事件,但我不确定这是否是正确的事件

谢谢你!

0 个答案:

没有答案