From f79df8871214f7f46c7557bfe24870873c3e8e14 Mon Sep 17 00:00:00 2001 From: bb_pan Date: Wed, 28 May 2025 14:10:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/home/map.vue | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/views/home/map.vue b/src/views/home/map.vue index 778378a..ccce2ea 100644 --- a/src/views/home/map.vue +++ b/src/views/home/map.vue @@ -26,12 +26,25 @@ const mapContainer = ref(null) // 地图容器 const mapDialog = ref(false) // 地图弹框 const mapWorkCard = ref(false) // 工牌信息弹框 const mapWorkCardData: any = ref({}) // 工牌信息数据 +// 定时器 +let timer: any = ref() // 标记点 const points: any = ref([]) const mapData = ref() const tagData: any = ref() const tagIndex: any = ref() +// 监听 mapDialog +watch( + () => mapDialog.value, + (newValue) => { + if (!newValue && timer.value) { + // 清除定时器 + clearInterval(timer.value) + } + }, +) + // 登录 const loginApi = async () => { try { @@ -274,6 +287,9 @@ const initMap = () => { mapDialog.value = true tagData.value = mapData.value.aphase tagIndex.value = 1 + timer.value = setInterval(() => { + loginApi() + }, 3000) } }) })