gemercheung 1 rok pred
rodič
commit
49e6eeb1e0
1 zmenil súbory, kde vykonal 20 pridanie a 15 odobranie
  1. 20 15
      src/views/map/index.vue

+ 20 - 15
src/views/map/index.vue

@@ -30,7 +30,7 @@
       has been loaded and the api and map instance are ready to be used -->
     <MarkerCluster>
       <template v-for="location in realLocations" :key="location.num">
-        <!-- <CustomMarker
+        <CustomMarker
           v-if="location.isPro"
           :options="{
             position: { lat: location.lat, lng: location.lng },
@@ -40,15 +40,17 @@
           @click="handleMarkerClick(location)"
         >
           <div class="custom-marker">{{ location.title }}</div>
-        </CustomMarker> -->
-        <AdvancedMarker
-          v-if="!location.isPro && location.lat && location.lng"
-          :options="{
-            position: { lat: location.lat, lng: location.lng },
-            title: location.title,
-          }"
-          @click="handleMarkerClick(location)"
-        />
+        </CustomMarker>
+        <template v-if="delayCluster">
+          <AdvancedMarker
+            v-if="!location.isPro && location.lat && location.lng"
+            :options="{
+              position: { lat: location.lat, lng: location.lng },
+              title: location.title,
+            }"
+            @click="handleMarkerClick(location)"
+          />
+        </template>
       </template>
     </MarkerCluster>
     <CustomControl position="TOP_LEFT">
@@ -165,7 +167,7 @@
     GoogleMap,
     AdvancedMarker,
     MarkerCluster,
-    // CustomMarker,
+    CustomMarker,
     // InfoWindow,
     CustomControl,
   } from 'vue3-google-map';
@@ -216,7 +218,7 @@
   });
 
   const mapRef = ref();
-  // const delayReady = ref(false);
+  const delayCluster = ref(false);
   const locations = ref<
     {
       lat: string;
@@ -248,7 +250,10 @@
       loadingRef.value = false;
       realLocations.value = locations.value;
       if (ready && lo.value.length > 0) {
-        mapFitBounds(mapRef, locations.value);
+        setTimeout(() => {
+          delayCluster.value = true;
+          mapFitBounds(mapRef, locations.value);
+        }, 600);
       }
     },
     {
@@ -385,12 +390,12 @@
   };
 
   const handleShare = async () => {
-    createMessage.warning(`测试提示:当前分享类型:${form.value.type}`);
+    // createMessage.warning(`测试提示:当前分享类型:${form.value.type}`);
     console.log('from', form.value);
     const res = await CreateShareMapApi(
       form.value.type,
       form.value.projectValue,
-      form.value.sceneValue,
+      form.value.searchValue,
     );
 
     const lang = isJA.value ? 'ja' : 'zh-CN';