소스 검색

标签页隐藏 mqtt没有更新数据

zhaobao 1 년 전
부모
커밋
4b6a9cf84d
1개의 변경된 파일5개의 추가작업 그리고 0개의 파일을 삭제
  1. 5 0
      src/views/bigScreen/home/components/carPlateInfo.vue

+ 5 - 0
src/views/bigScreen/home/components/carPlateInfo.vue

@@ -49,6 +49,11 @@ export default {
       this.initMqtt({
         mqttResponse: this.mqttResponse
       })
+      document.addEventListener('visibilitychange', () => {
+        if (document.visibilityState === 'visible') {
+          window.location.reload()
+        }
+      })
     },
     reload() {
       getTransList().then((resp) => {