优化称重首页图每秒刷新
This commit is contained in:
@@ -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<WorkOrderResp>({
|
||||
|
||||
Reference in New Issue
Block a user