fix:后台切前台导致网络报错问题解决

This commit is contained in:
2026-05-19 16:01:18 +08:00
parent 4518c66a65
commit f44c22c594

View File

@@ -296,6 +296,8 @@ onBeforeUnmount(() => {
const refreshTimer = ref(null);
onShow(async () => {
if (battleId.value) {
// 延迟 300ms 等待网络恢复,避免小程序从后台切回时网络尚未就绪导致请求失败报错
await new Promise(resolve => setTimeout(resolve, 300));
const result = await getBattleAPI(battleId.value);
if (!result) return;
if (result.status === 2) {