update:修复日志和防抖
This commit is contained in:
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user