瀏覽代碼

10.31关闭websocket

liuqiao 1 年之前
父節點
當前提交
181ca391a0
共有 1 個文件被更改,包括 15 次插入0 次删除
  1. 15 0
      src/views/index/HCFDLab/echartsHFCD.vue

+ 15 - 0
src/views/index/HCFDLab/echartsHFCD.vue

@@ -394,6 +394,21 @@ export default {
     },
   
   },
+    beforeDestroy() {
+    this.websock.close();
+    // 清除时间
+    clearTimeout(this.timeoutObj);
+    clearTimeout(this.serverTimeoutObj);
+  },
+  destroyed() {
+    this.websock.close();
+    //this.websock=null;
+    //console.log( this.websock.close());
+    // 清除时间
+    clearTimeout(this.timeoutObj);
+    clearTimeout(this.serverTimeoutObj);
+    console.log("关闭了websocket")
+  },
   
 };
 </script>