CanadaMes-ui/src/views/Electrical/Parameter.vue
@@ -75,7 +75,18 @@ this.isButtonDisabled = true; }, mounted() { window.addEventListener('beforeunload', this.closeSocket); }, beforeUnmount() { window.removeEventListener('beforeunload', this.closeSocket); }, methods: { closeSocket() { // 关闭 WebSocket 连接 socket.close(); }, showdata () { @@ -156,6 +167,9 @@ socket.onerror = function () { console.log("websocket发生了错误"); }; this.$router.afterEach(function(){ socket.close(); }) } }, send () {