From 213a9715a30c2c96113fbbbb5f4a9ccf5370a112 Mon Sep 17 00:00:00 2001 From: duanxiaohai <1812246227@qq.com> Date: Wed, 24 Jul 2024 15:20:37 +0800 Subject: [PATCH] gx --- src/view/sy_map.vue | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/view/sy_map.vue b/src/view/sy_map.vue index f979804..105683c 100644 --- a/src/view/sy_map.vue +++ b/src/view/sy_map.vue @@ -323,10 +323,11 @@ var map = null; const BMAP = () => { // 添加鼠标点击事件监听器 map.addEventListener("click", function (e) { - console.log(e.point, 666); - // console.log(e.latlng, 666); + console.log(e.point.latLng.lng,e.point.latLng.lat, 666); var pt = e.point; // 获取点击的坐标 - var marker = new BMapGL.Marker(pt); // 创建标注 + // map.addOverlay(marker); + var marker = new BMapGL.Marker(new BMapGL.Point(e.point.latLng.lng,e.point.latLng.lat)); // 创建点 + // var marker = new BMapGL.Marker(pt); // 创建标注 map.addOverlay(marker); // 将标注添加到地图中 }); }; @@ -336,13 +337,13 @@ const initMap = () => { map.enableScrollWheelZoom(true); map.setMapType(BMAP_EARTH_MAP); goMapCenter([119.178783, 29.034583], 12); - BMAP(); //加载乡镇信息 loadTown(); //渲染地块 addPolygonCounty(); //添加街道名 addJd(); + BMAP(); }; const loadTown = () => { for (let v of mapTown.features) {