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) } }) })