hejianhao
2025-04-21 c08d0ebace5e9f20eb442ad7cb1db05d61ecbd0d
src/components/MapPanel.vue
@@ -80,7 +80,7 @@
            }
            return item
          })
          if (!this.map) {
            this.currentMakers = JSON.parse(JSON.stringify(newData))
            this.markers = newData
@@ -101,7 +101,7 @@
      newData.forEach(newMarker => {
        const markerId = `${newMarker.longitude}-${newMarker.latitude}`
        const existingMarker = this.markerObjects[markerId]
        if (existingMarker) {
          // Update existing marker content
          const content = this.generateMarkerContent(newMarker)
@@ -129,11 +129,11 @@
      // Remove markers that no longer exist
      Object.keys(this.markerObjects).forEach(markerId => {
        const [longitude, latitude] = markerId.split('-')
        const markerExists = newData.some(marker =>
          marker.longitude === parseFloat(longitude) &&
        const markerExists = newData.some(marker =>
          marker.longitude === parseFloat(longitude) &&
          marker.latitude === parseFloat(latitude)
        )
        if (!markerExists) {
          this.markerObjects[markerId].setMap(null)
          delete this.markerObjects[markerId]
@@ -178,7 +178,7 @@
    },
    async initMap() {
      const map = await AMapLoader.load({
        key: '67968c82f27c7e2cb9f40c1a9aa3042b',
        key: '526e04b30ceba8f217c5def5a92392f9',
        version: '2.0',
        plugins: ['AMap.MarkerClusterer']
      })