Browse Source

fix 清除图标卡死bug

wangqin
qingzhengli 9 months ago
parent
commit
d373910081
  1. 41
      ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/utils/map.js

41
ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/utils/map.js

@ -202,32 +202,34 @@ export class MarkerCluster {
} = markerData; } = markerData;
const lngLatStr = `${lng}/${lat}`; const lngLatStr = `${lng}/${lat}`;
context.marker.setContent(getContent(lngLatMap[lngLatStr])); if (lngLatMap[lngLatStr]) {
context.marker.setContent(getContent(lngLatMap[lngLatStr]));
context.marker.setAnchor("bottom-center"); context.marker.setAnchor("bottom-center");
const offset = new AMap.Pixel(0, 0); const offset = new AMap.Pixel(0, 0);
context.marker.setOffset(offset); context.marker.setOffset(offset);
context.marker.setExtData(extData); context.marker.setExtData(extData);
context.marker.on("click", (e) => { context.marker.on("click", (e) => {
hasClick = true; hasClick = true;
const data = lngLatMap[lngLatStr]; const data = lngLatMap[lngLatStr];
if (data.length > 1) { if (data.length > 1) {
this.showInfoWindow(data); this.showInfoWindow(data);
return; return;
} }
console.log( console.log(
"%c [ 点击地图坐标 ]-302-「map.js」", "%c [ 点击地图坐标 ]-302-「map.js」",
"font-size:15px; background:#8f8c0b; color:#d3d04f;", "font-size:15px; background:#8f8c0b; color:#d3d04f;",
data[0] data[0]
); );
data[0].config.markerClick?.(data[0].extData, data[0].config?.item); data[0].config.markerClick?.(data[0].extData, data[0].config?.item);
}); });
}
}, },
}); });
@ -321,6 +323,7 @@ function getIcon({ config, extData }) {
} }
function getState(data) { function getState(data) {
console.log(data, Array.isArray(data), "getState");
if (Array.isArray(data)) { if (Array.isArray(data)) {
return data.every((item) => getStateSingle(item)); return data.every((item) => getStateSingle(item));
} else return getStateSingle(data); } else return getStateSingle(data);

Loading…
Cancel
Save