明树Git Lab

Commit 47077233 authored by chenron's avatar chenron

清除标记

parent 32460c79
Pipeline #104091 passed with stage
in 12 seconds
......@@ -172,6 +172,13 @@ const handleAddMarket = (selectName) => {
currentMarkers = [];
}
// 额外确保清除所有标记(防止其他地方创建的标记)
if (map) {
map.getAllOverlays("marker").forEach((marker) => {
map.remove(marker);
});
}
// 根据不同状态定义标记数据
const markerData = {
建设: [
......@@ -219,6 +226,11 @@ const handleAddMarket = (selectName) => {
const positionsList = markerData[selectName] || [];
// 如果是"立项"或者没有数据,直接返回,不创建任何标记
if (!positionsList || positionsList.length === 0) {
return;
}
// 创建新的标记
for (var i = 0; i < positionsList.length; i++) {
const marker = new AMap.Marker({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment