Selaa lähdekoodia

更新 航次详情船舶坐标

wangzhihui 4 vuotta sitten
vanhempi
commit
37372dd921
1 muutettua tiedostoa jossa 4 lisäystä ja 4 poistoa
  1. 4 4
      src/views/voyage/voyageDetail.vue

+ 4 - 4
src/views/voyage/voyageDetail.vue

@@ -347,14 +347,15 @@ export default {
       for (let i of media.value) {
         previewSrcList.value.push(i.downloadUrl);
       }
-      setShipMarker();
+      initMap(coordinates.value[0].longitude, coordinates.value[0].latitude);
     }
 
-    function initMap() {
+    function initMap(longitude = 121.524761, latitude = 31.228721) {
       map.value = new AMap.Map("map-container", {
         zoom: 11, //级别
-        center: [121.524761, 31.228721], //中心点坐标
+        center: [longitude, latitude], //中心点坐标
       });
+      setShipMarker(longitude, latitude);
     }
 
     function setShipMarker(longitude = 121.524761, latitude = 31.228721) {
@@ -477,7 +478,6 @@ export default {
     }
 
     onMounted(() => {
-      initMap();
       getVoyageDetail();
     });
     return {