官方文档:https://jimnox.gitee.io/amap-vue/references/map/

Amap是封装好的高德地图组件,易于使用。但私心说一句,不熟悉高德地图原生API的话,Amap-vue的官方文档对新手来讲不是很细致,还是多参考高德官方文档,对照着学习。

安装:

 npm install --save @amap/amap-vue

main.js

import AmapVue from '@amap/amap-vue';

AmapVue.config.version = '2.0'; 
AmapVue.config.key = 'xxxx';//申请的AMapKey
AmapVue.config.plugins = [
  'AMap.Autocomplete',
  'AMap.PlaceSearch',
  'AMap.Scale',
  'AMap.OverView',
  'AMap.ToolBar',
  'AMap.MapType',
  'AMap.PolyEditor',
  'AMap.CircleEditor',
  'AMap.Geocoder',
  'AMap.MarkerClusterer'
];
Vue.use(AmapVue);

基本使用:

<amap :zoom='11' :center="centerPos">
    <amap-marker :position="markerPos" />
</amap>

Logo

前往低代码交流专区

更多推荐