细节优化
This commit is contained in:
@@ -11,12 +11,13 @@ import useStore from "@/store";
|
||||
import { storeToRefs } from "pinia";
|
||||
const store = useStore();
|
||||
const { user } = storeToRefs(store);
|
||||
import { debounce } from "@/util";
|
||||
|
||||
const showModal = ref(false);
|
||||
const warnning = ref("");
|
||||
const roomNumber = ref("");
|
||||
|
||||
const enterRoom = async () => {
|
||||
const enterRoom = debounce(async () => {
|
||||
if (!roomNumber.value) {
|
||||
warnning.value = "请输入房间号";
|
||||
showModal.value = true;
|
||||
@@ -28,6 +29,7 @@ const enterRoom = async () => {
|
||||
);
|
||||
if (!alreadyIn) await joinRoomAPI(roomNumber.value);
|
||||
roomNumber.value = "";
|
||||
showModal.value = false;
|
||||
uni.navigateTo({
|
||||
url: `/pages/battle-room?roomNumber=${room.number}`,
|
||||
});
|
||||
@@ -36,8 +38,8 @@ const enterRoom = async () => {
|
||||
showModal.value = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
const createRoom = () => {
|
||||
});
|
||||
const onCreateRoom = () => {
|
||||
warnning.value = "";
|
||||
showModal.value = true;
|
||||
};
|
||||
@@ -74,7 +76,7 @@ const createRoom = () => {
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<SButton width="70%" :rounded="30" :onClick="createRoom">
|
||||
<SButton width="70%" :rounded="30" :onClick="onCreateRoom">
|
||||
创建约战房
|
||||
</SButton>
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user