fix(aiot): 前端截图刷新添加cache-busting防止浏览器缓存
给COS预签名URL附加_t=timestamp参数,确保每次刷新截图时 浏览器不使用缓存的旧图片。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -153,7 +153,9 @@ export default {
|
|||||||
getSnapUrl(this.cameraId, force).then(res => {
|
getSnapUrl(this.cameraId, force).then(res => {
|
||||||
const data = res.data || res
|
const data = res.data || res
|
||||||
if (data.status === 'ok' && data.url) {
|
if (data.status === 'ok' && data.url) {
|
||||||
this.snapUrl = data.url
|
// 添加时间戳防止浏览器缓存旧截图
|
||||||
|
const url = data.url
|
||||||
|
this.snapUrl = url + (url.includes('?') ? '&' : '?') + '_t=' + Date.now()
|
||||||
if (data.stale) {
|
if (data.stale) {
|
||||||
this.$message.warning('截图为缓存数据,边缘设备可能离线')
|
this.$message.warning('截图为缓存数据,边缘设备可能离线')
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user