From 72a9b45dec019ad6a7e817725a4dfa740d0421f9 Mon Sep 17 00:00:00 2001 From: xiaosi <2652281683@qq.com> Date: Thu, 27 Aug 2026 12:00:21 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20Replay=20=E5=8D=B8=E8=BD=BD=E6=97=B6?= =?UTF-8?q?=E5=8F=96=E6=B6=88=E6=9C=AA=E8=A7=A6=E5=8F=91=E7=9A=84=E5=9C=B0?= =?UTF-8?q?=E5=9B=BE=20load=20=E5=9B=9E=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ReplayView/ReplayView.vue | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/views/ReplayView/ReplayView.vue b/src/views/ReplayView/ReplayView.vue index e208d9d..1ac9b02 100644 --- a/src/views/ReplayView/ReplayView.vue +++ b/src/views/ReplayView/ReplayView.vue @@ -51,7 +51,6 @@ import * as urls from '@/config/urls' import commonRefs from '@/utils/commonRefs' import mapHelper from '@/core/mapHelper' -const LAYER_ID = 'replay-traj' const SOURCE_ID = 'replay-traj' const LINE_LAYER = 'replay-traj-line' const POINT_LAYER = 'replay-traj-points' @@ -65,6 +64,7 @@ const points = ref([]) const loaded = ref(false) let mapInstance = null +let pendingLoadHandler = null const recordName = computed(() => execution.value?.taskId || '执行记录') const deviceName = computed(() => execution.value?.droneSn || execution.value?.dockId || '--') @@ -187,11 +187,19 @@ async function setupMap() { mapInstance = map mapHelper.toggleMapMode({ is2D: true }) const run = () => drawTrajectory(map, points.value) - if (map.isStyleLoaded()) run() - else map.once('load', run) + if (map.isStyleLoaded()) { + run() + } else { + pendingLoadHandler = run + map.once('load', pendingLoadHandler) + } } function teardownMap() { + if (mapInstance && pendingLoadHandler) { + mapInstance.off('load', pendingLoadHandler) + pendingLoadHandler = null + } clearReplayLayers(mapInstance) mapInstance = null commonRefs.clearPendingList('map')