npm install vue-amap2.x --save
<VueAmap2x :mapOptions="mapOptions" :plugins="plugins" v-on:pluginInstalled="handleGeolocation" mapKey="ccd1e3a84dd69c646c53abd884db7141" v-on:moveend="handleMoveEnd" v-on:complete="handleMapLoaded" :center="center" v-on:zoomend="handleZoomEnd"></VueAmap2x>
申请key
mapOptions = {
mapStyle: "amap://styles/light",
center: [],
zoom: [],
...
}
参考高德地图官方插件文档
注意,plugins是数组类型,此方式是采用异步加载插件,加载完插件后可以监听插件安装完回调事件,v-on:pluginInstalled.
- zoomstart
- zoomchange
- zoomend
- movestart
- mapmove
- moveend
- dragstart
- dragging
- dragend
- complete