diff --git a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/index.vue b/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/index.vue index 259b629c..f062538e 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/index.vue +++ b/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) { diff --git a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/utils/map.js b/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/utils/map.js index 619bf64a..8775cb68 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/utils/map.js +++ b/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) {