fuliqi
2024-11-26 42e1d8e76fbf40f053a480cfdd359c9479b1cd63
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,12 +213,15 @@
            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.$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() {
  beforeDestroy() {
        this.map = null;
    },
  }
};
// const emits = defineEmits<{