diff --git a/pages/map/index.vue b/pages/map/index.vue index bb7d3a1..345626b 100644 --- a/pages/map/index.vue +++ b/pages/map/index.vue @@ -80,7 +80,7 @@ @beforeleave="onBeforeLeave" > + @afterHide="onAfterHide" --> + >1111 --> {{ - currMarker.plateNumber || currMarker.name + currMarker.plateNumber || currMarker.shortName || currMarker.name }} - + + + + 加氢站全称:{{ currMarker.name || "--" }} + + 氢源:{{ currMarker.hydrogenSource || "--" }} @@ -661,7 +670,6 @@ export default { onPullDownRefresh(event) {}, mounted() { console.log("mounted"); - this.$store.state.current = "map"; this.sectionChange(this.current); this.getOrgList(); this.getAreaList(); @@ -678,8 +686,13 @@ export default { } // 清理地图事件监听器 if (this._mapContext) { - this._mapContext.off("markerClusterCreate"); - this._mapContext.off("markerClusterClick"); + // 直接移除所有监听器,不需要传递回调函数 + try { + this._mapContext.off("markerClusterCreate"); + this._mapContext.off("markerClusterClick"); + } catch (e) { + console.log("移除地图事件监听器失败:", e); + } this._mapContext = null; } }, @@ -1154,8 +1167,12 @@ export default { createMapContext() { // 清理之前的地图上下文,防止重复创建 if (this._mapContext) { - this._mapContext.off("markerClusterCreate"); - this._mapContext.off("markerClusterClick"); + try { + this._mapContext.off("markerClusterCreate"); + this._mapContext.off("markerClusterClick"); + } catch (e) { + console.log("移除地图事件监听器失败:", e); + } this._mapContext = null; } @@ -1272,7 +1289,7 @@ export default { iconPath = item.cooperate ? `/static/maph.png` : `/static/maph2.png`; - calloutText = item.stationName; + calloutText = item.shortName || item.stationName; break; } // let flag = false; @@ -1624,6 +1641,7 @@ export default { justify-content: space-between; align-items: center; text-align: center; + margin: 8rpx; font-size: 24rpx; .item { flex: 1;