高德地图Autocomplete坑

高德地图Autocomplete插件中的select方法返回值ev.poi.location有时候是undefined??

代码:

//注册监听,当选中某条记录时会触发
AMap.event.addListener(auto, 'select', function(ev) {
     console.log(ev)
     if (!ev.poi.location) return;
     //关键字查询
     state.mapForm.address = `${ev.poi.district}${ev.poi.address}`;
     state.mapForm.longitude = `${ev.poi.location.lng}`;
     state.mapForm.latitude = `${ev.poi.location.lat}`;
     addMarker();
});
Comments
登录后评论
Sign In