Commit 3e88f29b by 周田

mod: 注销组件时,关闭 websocket 通信

parent 3e57e0f6
......@@ -45,7 +45,7 @@
</template>
<script setup lang="ts">
import { ref, onMounted, watch } from 'vue';
import { ref, onMounted, watch, onBeforeUnmount } from 'vue';
import { ElScrollbar, ElInput, ElButton, ElSelect, ElOption, ElMessage } from 'element-plus';
import DevicePerformanceTable from '@/components/home/DevicePerformanceTabel'
import axios from 'axios';
......@@ -113,6 +113,10 @@ onMounted(() => {
})
})
onBeforeUnmount(() => {
chatSocket?.close();
})
// 添加设备监控操作
const deviceInfos = ref<any[]>([]);
const selectedDeviceName = ref<string>('')
......
......@@ -74,9 +74,7 @@ const del = () => {
}
onBeforeUnmount(() => {
if (table_websocket!.OPEN) {
table_websocket!.close()
}
table_websocket?.close()
})
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment