Gaokun Wang 5 dienas atpakaļ
vecāks
revīzija
0e67171af4
2 mainītis faili ar 4 papildinājumiem un 2 dzēšanām
  1. 3 1
      src/layouts/index.vue
  2. 1 1
      src/utils/webSocket.ts

+ 3 - 1
src/layouts/index.vue

@@ -35,10 +35,12 @@ const handleClickMenu = (path: string) => {
   router.push(path)
 }
 const reload = () => {
+  location.reload()
+}
+const relink = () => {
   let protocol = window.location.protocol === 'https:' ? 'wss://' : 'ws://'
   initWebSocket(protocol + window.location.host + '/websocket')
 }
-const relink = () => {}
 const path = computed(() => {
   return router.currentRoute.value.path
 })

+ 1 - 1
src/utils/webSocket.ts

@@ -57,7 +57,7 @@ export const lastMessage = ref<any>(null)
 
 // 初始化 WebSocket 连接
 export const initWebSocket = (url: string) => {
-  console.log('正在初始化 WebSocket 连接...')
+  console.log('正在初始化 WebSocket 连接...', url)
 
   const { status, data, send, open, close } = useWebSocket(url, {
     autoReconnect: {