**
调用高德地图api
main.js:
import VueAMap from ‘vue-amap’
Vue.use(VueAMap);
VueAMap.initAMapApiLoader({
key: ‘213fefcfed9d370602c53d52b9029307’,
plugin: [‘AMap.Autocomplete’, ‘AMap.PlaceSearch’, ‘AMap.Scale’, ‘AMap.OverView’, ‘AMap.ToolBar’, ‘AMap.MapType’, ‘AMap.PolyEditor’, ‘AMap.CircleEditor’],
v: ‘1.4.4’
})
html:
< div id=“container” class=“map” v-if=“showMap”>
js:
getMap(){
const that = this;
this.showMap = true;
let map = new AMap.Map(“container”, {
resizeEnable: true,
})
map.on(‘click’, function(e) {
that.longitude = e.lnglat.getLng();
that.latitude = e.lnglat.getLat();
})
}