Google maps 谷歌地图自动完成api与规范不同

Google maps 谷歌地图自动完成api与规范不同,google-maps,autocomplete,google-places-api,Google Maps,Autocomplete,Google Places Api,我在戏弄google places API,我在Autocomplete遇到了奇怪的行为,我不明白 我就是这样使用它的: const AUTOCOMPLETE_OPTIONS = { types: ['address'], componentRestrictions: { country: 'cz' } }; this.inputPlaceElement = $('#search-around-input') this.inputPlaceSearchBox = new googl

我在戏弄google places API,我在Autocomplete遇到了奇怪的行为,我不明白

我就是这样使用它的:

const AUTOCOMPLETE_OPTIONS = {
 types: ['address'],
 componentRestrictions: {
    country: 'cz'
 }
};
this.inputPlaceElement = $('#search-around-input')
this.inputPlaceSearchBox = new google.maps.places.Autocomplete(this.inputPlaceElement[0], AUTOCOMPLETE_OPTIONS);
google.maps.event.addListener(this.inputPlaceSearchBox,'places_changed', () => {
  console.log('place change')
})
Autocomplete输入正常工作,但place_changed没有触发,我正在尝试使用它,从构造函数返回的对象很奇怪。 当我调用getBounds()或getPlace()方法时,存在未定义的

这就是问题所在:我不确定出了什么问题


选择地点时触发的事件是“地点已更改”,而您的样本使用“地点已更改”

尝试:

google.maps.event.addListener(this.inputPlaceSearchBox,'place_changed', function() {
  console.log('place change')
});