From 2c9999d20ae7e98cb1ac31ff5b4594ce4c49a9d6 Mon Sep 17 00:00:00 2001 From: luohairen <3399054449@qq.com> Date: 星期四, 12 十二月 2024 17:24:24 +0800 Subject: [PATCH] 调整 --- src/views/components/Map/index.vue | 28 ++++++++++++++++------------ 1 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/views/components/Map/index.vue b/src/views/components/Map/index.vue index 38f61f6..a9fee43 100644 --- a/src/views/components/Map/index.vue +++ b/src/views/components/Map/index.vue @@ -198,7 +198,7 @@ offset: [-35, -45], labelBg: "#3369FF", labelColor: "#fff", - labelClick, + labelClick: this.labelClick, }; // 娓呴櫎涔嬪墠鐨勬爣璁� this.map && this.map.clearOverLays(); @@ -213,13 +213,16 @@ const { lat, lng: lon } = e.lnglat; this.makeDefaultMask({ - ...defaultMaskInfo, + ...this.defaultMaskInfo, lon: String(lon), lat: String(lat), }); - this.getReverseGeocode(e).then((addr) => { - this.$emit("mapClick", { e, addr }); + this.getReverseGeocode(e).then((addr) => { + this.$emit("mapClick", { + e, + addr, }); + }); console.log("鐐瑰嚮浜嬩欢", e); }, @@ -360,9 +363,9 @@ } this.addEvent(marker, "mouseover", (e) => - markerMouseover(e, infoWin, labelOptions, getUniqueId()) + this.markerMouseover(e, infoWin, labelOptions, this.getUniqueId()) ); - this.addEvent(marker, "mouseout", (e) => markerMouseout(e, infoWin)); + this.addEvent(marker, "mouseout", (e) => this.markerMouseout(e, infoWin)); }, // 鏍囪鎵�鏈夌偣 @@ -401,7 +404,7 @@ //鏍囪鐐瑰嚮浜嬩欢 markerClick(currentLabel, e) { const id = e.target.options.id; - currentLabelStyleChange(currentLabel); + this.currentLabelStyleChange(currentLabel); console.log("鐐瑰嚮浜嬩欢", e, currentLabel); this.getReverseGeocode(e).then((addr) => { this.$emit( @@ -415,9 +418,10 @@ // label鐐瑰嚮浜嬩欢 labelClick(currentLabel, e) { + console.log("瑙﹀彂鐐瑰嚮浜嬩欢") const id = e.target.options.id; - currentLabelStyleChange(currentLabel); - getReverseGeocode(e).then((addr) => { + this.currentLabelStyleChange(currentLabel); + this.getReverseGeocode(e).then((addr) => { this.$emit( "labelClick", id @@ -449,9 +453,9 @@ }, }, }, - beforeUnmount() { - this.map = null; - }, + beforeDestroy() { + this.map = null; + } }; // const emits = defineEmits<{ -- Gitblit v1.8.0