From 8d926b37cd0b1373f8d3eef91f8c2cb5073dddd9 Mon Sep 17 00:00:00 2001 From: joylink_zhaoerwei Date: Wed, 20 Dec 2023 17:36:32 +0800 Subject: [PATCH] =?UTF-8?q?socket=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/webSocketConnect.ts | 3 ++- src/layouts/MainLayout.vue | 2 +- src/pages/AlarmInfoList.vue | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/webSocketConnect.ts b/src/components/webSocketConnect.ts index c4881f6..d0042a7 100644 --- a/src/components/webSocketConnect.ts +++ b/src/components/webSocketConnect.ts @@ -20,8 +20,9 @@ export function webSocketConnect( socket?.subscribe(destination, handler); }); socket.on('disconnected', () => { - console.log(6666); + console.log('disconnected'); }); + return socket; } export function closeWebSocketConnect( diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index 058dea0..18f9327 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -165,7 +165,7 @@ onMounted(() => { } document.addEventListener('click', watchInteract); document.addEventListener('keydown', watchInteract); - webSocketConnect(socket, destination, handler); + socket = webSocketConnect(socket, destination, handler); }); //模拟报警 diff --git a/src/pages/AlarmInfoList.vue b/src/pages/AlarmInfoList.vue index 0493f34..0037e41 100644 --- a/src/pages/AlarmInfoList.vue +++ b/src/pages/AlarmInfoList.vue @@ -372,7 +372,7 @@ onMounted(() => { setTimeout(() => { tableRef.value.requestServerInteraction(); lineNetStore.alarmInfoListTable = tableRef.value; - webSocketConnect(socket, destination, handler); + socket = webSocketConnect(socket, destination, handler); }); });