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;
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);
context.marker.setOffset(offset);
const offset = new AMap.Pixel(0, 0);
context.marker.setOffset(offset);
context.marker.setExtData(extData);
context.marker.setExtData(extData);
context.marker.on("click", (e) => {
hasClick = true;
context.marker.on("click", (e) => {
hasClick = true;
const data = lngLatMap[lngLatStr];
if (data.length > 1) {
this.showInfoWindow(data);
return;
}
const data = lngLatMap[lngLatStr];
if (data.length > 1) {
this.showInfoWindow(data);
return;
}
console.log(
"%c [ 点击地图坐标 ]-302-「map.js」",
"font-size:15px; background:#8f8c0b; color:#d3d04f;",
data[0]
);
console.log(
"%c [ 点击地图坐标 ]-302-「map.js」",
"font-size:15px; background:#8f8c0b; color:#d3d04f;",
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) {
console.log(data, Array.isArray(data), "getState");
if (Array.isArray(data)) {
return data.every((item) => getStateSingle(item));
} else return getStateSingle(data);

Loading…
Cancel
Save