Browse Source

离开仪表盘页面时关闭WebSocket,避免一直在后台拉取信息损耗性能

woncode 16 hours ago
parent
commit
b9c360702a
1 changed files with 4 additions and 0 deletions
  1. 4 0
      app/src/views/dashboard/ServerAnalytic.vue

+ 4 - 0
app/src/views/dashboard/ServerAnalytic.vue

@@ -90,6 +90,10 @@ onMounted(() => {
   })
 })
 
+onUnmounted(() => {
+  websocket?.close()
+})
+
 function handle_uptime(t: number) {
   // uptime
   let _uptime = Math.floor(t)