1.安装插件:
npm install vue-amap --save
2.main.js中
import AMap from 'vue-amap'
Vue.use(AMap);
3.index.html文件中
<script type="text/javascript" src="http://webapi.amap.com/maps?v=1.3&key=c76c4e9a861fe1f715c48d893d07116b"></script>
4.加载地图的页面
<el-amap id="mapcointainer" style="height: 300px;"></el-amap>
import {lazyAmapApiLoaderInstanse} from 'vue-amap';
export default {
data () {
return {
}
},
mounted() {
this.map = new AMap.Map('mapcointainer', {
resizeEnable:true,
zoom:11,
center:[116.397428,39.90923]
})
}
}