删除某个marker
var singleMarker; //全局定义marker
map.remove(singleMarker); //删除自己定义的marker
删除地图上所有的marker
map.clear();
添加
this.marker.on('dragend', (e) => {
this.latitudepois = e.lnglat.lat
this.longitudepois = e.lnglat.lng
a = e.lnglat.lng
b = e.lnglat.lat
AMap.plugin('AMap.Geocoder', () => {
var geocoder = new AMap.Geocoder({
city: '',
})
lnglat = [a, b]
geocoder.getAddress(lnglat, (status, result) => {
if (status === 'complete' && result.info === 'OK') {
this.sousuo = result.regeocode.formattedAddress
this.cityCode1 = result.regeocode.addressComponent.citycode
this.latitudepois = e.lnglat.lat
this.longitudepois = e.lnglat.lng
}
})
})
})