<el-row>
<el-col :xs="24" :sm="12" :lg="8">
<el-form-item label="大坝坐标">
<el-input
prefix-icon="el-icon-location"
size="small"
clearable
v-model="formData.map"
></el-input>
</el-form-item>
</el-col>
</el-row>
<!-- 地图 -->
<div class="map" id="map"></div>
import AMap from 'AMap'
import AMapUI from 'AMapUI'
mounted () {
this.initMap();
},
initMap() {
let _this = this;
this.amap = new AMap.Map("map", {
zoom: 13,
center: [121.499568,31.239344]
});
this.amap.on("click", showInfoClick);
function showInfoClick(e) {
console.log(e);
if(!_this.marker){
_this.marker = new AMap.Marker({
position: e.lnglat,
title: '上海'
});
_this.amap.add(_this.marker);
}
_this.marker.setPosition(e.lnglat)
}
}
toMap() {
this.mapVisible = true;
setTimeout(() => {
this.getMap();
}, 0);
},
地图是点击大坝搜索框进来的
\
想要效果:
![2.JPG](https:
最后,怎么把坐标点的详细地址回显到大坝input中,