diff --git a/web-vue/src/components/TopNavbar.vue b/web-vue/src/components/TopNavbar.vue index 768c06f..14d1bd3 100644 --- a/web-vue/src/components/TopNavbar.vue +++ b/web-vue/src/components/TopNavbar.vue @@ -178,6 +178,7 @@ const handleUserCommand = (command) => { passwordVisible.value = true } else if (command === 'logout') { ElMessageBox.confirm('确定退出登录吗?', '提示', { type: 'warning' }).then(() => { + chatService.disconnect() // 断开 WebSocket 连接 userStore.logout() router.push('/login') }).catch(() => {})