mian中引用
import VueAMap from 'vue-amap' Vue.use(VueAMap) VueAMap.initAMapApiLoader({ key: '6cf4109dca43906adfe00d4bbb6d93b5', // 康药麦麦高德key plugin: [ 'AMap.Autocomplete', 'AMap.PlaceSearch', 'AMap.Scale', 'AMap.OverView', 'AMap.ToolBar', 'AMap.MapType', 'AMap.PolyEditor', 'AMap.CircleEditor', 'AMap.Geolocation' ], // 默认高德 sdk 版本为 1.4.4 v: '1.4.4' })
然后再index.html中添加script 把plugin中的组件都引用下
注意:把script 放在body上面
<script type="text/javascript" src="https://webapi.amap.com/maps?key=6cf4109dca43906adfe00d4bbb6d93b5&v=1.4.4&plugin=AMap.Geolocation,AMap.Autocomplete,AMap.PlaceSearch,AMap.Scale,AMap.OverView,AMap.ToolBar,AMap.MapType,AMap.PolyEditor,AMap.CircleEditor"></script>