update:修复日志和防抖

This commit is contained in:
2026-07-09 14:35:48 +08:00
parent f8efe4c4a4
commit 12729a1cef
5 changed files with 106 additions and 31 deletions
+7 -2
View File
@@ -36,6 +36,7 @@ const createRoom = debounce(async () => {
}
if (loading.value === true) return;
loading.value = true;
let keepLoading = false;
let size = 2;
if (battleMode.value === 2) size = 10;
if (battleMode.value === 3) size = 4;
@@ -49,14 +50,18 @@ const createRoom = debounce(async () => {
if (result.number) {
props.onConfirm();
await joinRoomAPI(result.number);
keepLoading = true;
uni.navigateTo({
url: "/pages/battle-room?roomNumber=" + result.number + "&target=" + targetMode.value,
fail: () => {
loading.value = false;
},
});
}
} catch (error) {
console.log(error);
} finally {
loading.value = false;
if (!keepLoading) loading.value = false;
}
});
</script>
@@ -112,7 +117,7 @@ const createRoom = debounce(async () => {
<text>40厘米全环靶</text>
</view>
</view>
<SButton :onClick="() => $clickSound(createRoom)">创建房间</SButton>
<SButton :disabled="loading" :onClick="() => { $clickSound(); return createRoom(); }">创建房间</SButton>
</view>
</template>