一、在vue-cli的框架下的main.js(或者main.ts)中引入高德插件,代码如下:
import Vue from \'vue\' import VueAMap from \'vue-amap\' import ElementUI from \'element-ui\' import App from \'./App.vue\' import router from \'./router\' import store from \'./store\' import \'./registerServiceWorker\' Vue.use(VueAMap) Vue.use(ElementUI) VueAMap.initAMapApiLoader({ // 高德的key key: \'你的高德key\', // 插件集合 plugin: [ \'AMap.Autocomplete\', \'AMap.PlaceSearch\', \'AMap.Scale\', \'AMap.OverView\', \'AMap.ToolBar\', \'AMap.MapType\', \'AMap.PolyEditor\', \'AMap.CircleEditor\', \'AMap.Geocoder\', \'AMap.Geolocation\' ], // 高德 sdk 版本,默认为 1.4.4 v: \'1.4.10\' }) Vue.config.productionTip = false new Vue({ router, store, render: h => h(App) }).$mount(\'#app\')