Browse Source

fix bug 频道切换后地图显示的标注数量不对问题

wangqin
qingzhengli 8 months ago
parent
commit
3f0c6be278
  1. 1
      ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/index.vue
  2. 9
      ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/utils/map.js

1
ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/index.vue

@ -183,6 +183,7 @@ export default {
beforeDestroy() {
this.emitter.off("selectedCompleted", this.selectedCompletedHandle);
Object.keys(lngLatMap).forEach(key => delete lngLatMap[key]);
window.renderData = undefined;
},
methods: {
selectedCompletedHandle(item) {

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

@ -39,7 +39,7 @@ export class MarkerCluster {
markerCluster;
infoWindow;
data = [];
data = []; //标注集合
constructor() {}
@ -115,7 +115,7 @@ export class MarkerCluster {
window.totalPages = totalPages;
let num = (page - 1) * pageSize;
function renderData(page) {
if (page < 1 || page > totalPages) return;
if (!data || page < 1 || page > totalPages) return;
window.page = page;
const pageSize = window.pageSize;
const dataContainer = document.getElementById("dataContainer");
@ -127,7 +127,7 @@ export class MarkerCluster {
const startIndex = (page - 1) * pageSize;
const endIndex = startIndex + pageSize;
let num = (page - 1) * pageSize;
if (!data || data.length === 0 || data.length === 1) {
if (data.length === 0 || data.length === 1) {
return this.infoWindow.close();
}
const { latitude: lat, longitude: lng } = data[0].extData;
@ -391,6 +391,9 @@ export class MarkerCluster {
setData() {
this.markerCluster.setData(this.data);
}
clear() {
this.data = [];
}
}
export function getContent(data) {

Loading…
Cancel
Save