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({