From 2dc2d4887d375b90cd07ebbc77b2851b21fc7554 Mon Sep 17 00:00:00 2001 From: zc Date: Tue, 17 Mar 2026 16:28:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=A7=B0=E9=87=8D=E9=A6=96?= =?UTF-8?q?=E9=A1=B5=E5=9B=BE=E6=AF=8F=E7=A7=92=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/weightManage/index.vue | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/views/weightManage/index.vue b/src/views/weightManage/index.vue index 1e92ee3..efecb5c 100644 --- a/src/views/weightManage/index.vue +++ b/src/views/weightManage/index.vue @@ -299,6 +299,7 @@ const formData = reactive({ const imgData = reactive({ imgUrl: 'http://localhost:6609/file/001.bmp', // 样图URL + baseUrl: 'http://localhost:6609/file/001.bmp' // 基础URL }) //比对结果 @@ -540,14 +541,28 @@ watch(activeStep, (newVal) => { } }) +// 图片刷新定时器 +let imageRefreshTimer: any = null + // 组件挂载时 onMounted(async () => { await loadFlvJs() + + // 启动图片自动刷新,每秒更新一次 + imageRefreshTimer = setInterval(() => { + // 添加时间戳参数,避免浏览器缓存 + imgData.imgUrl = `${imgData.baseUrl}?t=${Date.now()}` + }, 1000) }) // 组件卸载时 onBeforeUnmount(() => { stopCamera() + // 清除图片刷新定时器 + if (imageRefreshTimer) { + clearInterval(imageRefreshTimer) + imageRefreshTimer = null + } }) const workOrderResp = ref({