cnpm install vue-amap -S // 安装项目依赖
项目 main.js里面:
import VueAMap from 'vue-amap'
Vue.use(VueAMap)
// 配置
VueAMap.initAMapApiLoader({
key: 'c800ea593e4d8138cfe450b2c672d002', // 在高德开放平台上申请的 web Pc端 key
plugin: ['AMap.Autocomplete', 'AMap.PlaceSearch', 'AMap.Scale', 'AMap.OverView', 'AMap.ToolBar', 'AMap.MapType', 'AMap.PolyEditor', 'AMap.CircleEditor', 'AMap.TruckDriving', 'AMap.Geolocation'],
// 默认高德 sdk 版本为 1.4.4
v: '1.4.4'
})
<style>
.amap-demo {
height: 400px;
}
</style>
<template>
<el-row>
<el-col :span="24">
<div>
<el-amap vid="amapDemo" :center="center" :plugin="plugin" ref="map" class="amap-demo" style="height: 400px;">
<el-amap-marker v-for="(item,index) in computedCarList" :position="item.marker" :key="in