map.onclick(e => {
//Prj是leaflet经纬度转换成腾讯使用的经纬度
const gcjLocation = Prj.wgsToGcj(
e.latlng.lat,
e.latlng.lng
);
this.handleLatLngToAddress(gcjLocation, res => {
this.locationAddress = res.detail;
this.Cmap.addMarker(e.latlng);
this.locationInfo = ${e.latlng.lng.toFixed( 4 )}, ${e.latlng.lat.toFixed(4)}
;
})
})
//腾讯地图解析经纬度的方法
handleLatLngToAddress(latlng, complete) {
let latLng = new window.qq.maps.LatLng(latlng.lat, latlng.lng);
if (window.qq) {
this.geoCoder = new window.qq.maps.Geocoder({ complete });
}
this.geoCoder.getAddress(latLng);
},