首先在官网申请密钥:https://lbs.amap.com申请密钥
1. 在index.html中引入:
<script type="text/javascript" src="http://webapi.amap.com/maps?v=1.3&key=刚刚申请的密钥"></script>
2. webpack.base.conf.js修改:
externals: {
'AMap': 'AMap','AMapUI': 'AMapUI'}
3.创建 BaseMap.vue
我这里对地图的要求较少,只需要展示即可,大家根据自己的需求添加不同的功能
<!-- 地图 -->
<template>
<div class="map-container" id="container"></div>