ElemeFE / vue-amap

🌍 基于 Vue 2.x 和高德地图的地图组件
https://elemefe.github.io/vue-amap/
MIT License
3.33k stars 584 forks source link

使用高德版本 v:2.0 之后 绑定evenet 报请等待地图加载完毕之后再进行绑定事件错误 #684

Open LiveAckerman opened 2 years ago

LiveAckerman commented 2 years ago

问题

使用高德版本 v:2.0 之后 绑定evenet 报请等待地图加载完毕之后再进行绑定事件错误 Error in event handler for "AMAP_READY_EVENT": "Error: please wait for Map API load" please wait for Map API load

VueAMap 版本

最新npm版本

OS/Browsers version

谷歌

Vue 版本

v2.6.11

复现地址

预期

能正常绑定事件

实际

绑定事件失败

feature request

LiveAckerman commented 2 years ago

image

LiveAckerman commented 2 years ago

image 不进行event绑定就不会报错

LiveAckerman commented 2 years ago

image

LiveAckerman commented 2 years ago

找到原因了 新版高德地图将event改成Event了 导致 源码中这个判断过不了 image 解决办法为 在 vue的created 增加 window.AMap.event = window.AMap.Event; image

yangyanggu commented 2 years ago

推荐用 @vuemap/vue-amap