wip: 临时提交

This commit is contained in:
Ray.Hao
2025-04-22 22:15:15 +08:00
parent cad57b3dc0
commit 55218701d0
9 changed files with 1177 additions and 7 deletions

16
src/plugins/websocket.ts Normal file
View File

@@ -0,0 +1,16 @@
import { useWebSocketDict } from "@/hooks/useWebSocketDict";
/**
* 初始化WebSocket服务
*/
export function setupWebSocket() {
const dictWebSocket = useWebSocketDict();
// 初始化字典WebSocket服务
dictWebSocket.initWebSocket();
// 在窗口关闭前断开WebSocket连接
window.addEventListener("beforeunload", () => {
dictWebSocket.closeWebSocket();
});
}