wzg 1 рік тому
батько
коміт
a129d0f135

+ 3 - 2
src/components/AMapContainer.vue

@@ -20,7 +20,7 @@
   </div>
 </template>
 <script setup>
-import { onMounted, onUnmounted, ref } from "vue";
+import { onMounted, onUnmounted, ref, nextTick } from "vue";
 import AMapLoader from "@amap/amap-jsapi-loader";
 import router from "../router";
 import { useRoute } from "vue-router";
@@ -233,7 +233,8 @@ function generateMarkers(points, type) {
   return markers;
 }
 
-function drawMarkers() {
+async function drawMarkers() {
+  await nextTick();
   let markers = [
     ...generateMarkers(props.ships, "ships"),
     ...generateMarkers(props.loadPorts, "loadPorts"),

+ 1 - 2
src/views/index/Index.vue

@@ -287,7 +287,6 @@ import {
   computed,
   onMounted,
   inject,
-  nextTick,
   onUnmounted,
 } from "vue";
 import { ElNotification } from "element-plus";
@@ -351,7 +350,6 @@ async function getIndexData(type) {
       } else {
         drawPie();
       }
-      await nextTick();
       mapRef.value.drawMarkers();
     } else {
       indexData.value = {
@@ -361,6 +359,7 @@ async function getIndexData(type) {
         totalVoyageNum: 0,
         unfinshDiscTons: 0,
       };
+      ships.value = [];
       if (type == "init") {
         drawPie("init");
       } else {

+ 0 - 2
src/views/voyage/voyageDetail.vue

@@ -2101,8 +2101,6 @@ async function getVoyageDetail(isInit) {
       getPortWeatherList();
       getAccidentList();
     }
-    await nextTick();
-
     mapRef.value.drawMarkers();
   } else {
     console.log(res);