修复断开连接后成员列表界面卡死的情况

This commit is contained in:
黑先森
2024-11-28 10:59:10 +08:00
parent 779f5cecf1
commit 5e418bd6e5
4 changed files with 14 additions and 10 deletions
+4 -5
View File
@@ -134,6 +134,7 @@ import { getCurrentWindow } from "@tauri-apps/api/window";
return "";
}
if (member === "_EasytierGameCliFailedToConnect_") {
data.member = [];
stopTimer();
const [error] = await ElConfirmDanger("连接已断开,是否重新尝试?", "警告", {
confirmButtonText: "重试",
@@ -145,7 +146,6 @@ import { getCurrentWindow } from "@tauri-apps/api/window";
const appWindow = getCurrentWindow();
await appWindow.close();
}
data.member = [];
return;
}
const peerInfo = parsePeerInfo(member);
@@ -161,10 +161,10 @@ import { getCurrentWindow } from "@tauri-apps/api/window";
startTimer();
};
const startTimer = async () => {
const startTimer = () => {
timer && clearTimeout(timer);
timer = setTimeout(async () => {
await listenOutput();
timer = setTimeout(() => {
listenOutput();
}, 1000);
};
@@ -175,7 +175,6 @@ import { getCurrentWindow } from "@tauri-apps/api/window";
onMounted(async () => {
await listenOutput();
await startTimer();
});
onBeforeUnmount(() => {