代码优化
This commit is contained in:
@@ -62,16 +62,18 @@ const onCreateRoom = async () => {
|
||||
showModal.value = true;
|
||||
};
|
||||
const onSignin = () => {
|
||||
if (roomID.value && user.value.id) enterRoom(roomID.value);
|
||||
showSignin.value = false;
|
||||
if (roomID.value) enterRoom(roomID.value);
|
||||
};
|
||||
onShow(async () => {
|
||||
const result = await getBattleDataAPI();
|
||||
data.value = result;
|
||||
if (user.value.id) {
|
||||
const result = await getBattleDataAPI();
|
||||
data.value = result;
|
||||
}
|
||||
});
|
||||
onLoad(async (options) => {
|
||||
roomID.value = options.roomID || "";
|
||||
if (options.roomID) {
|
||||
roomID.value = options.roomID;
|
||||
if (user.value.id) enterRoom(options.roomID);
|
||||
else showSignin.value = true;
|
||||
}
|
||||
@@ -167,9 +169,7 @@ onLoad(async (options) => {
|
||||
</view>
|
||||
<CreateRoom v-if="!warnning" :onConfirm="() => (showModal = false)" />
|
||||
</SModal>
|
||||
<SModal :show="showSignin" :onClose="() => (showSignin = false)">
|
||||
<Signin :onClose="onSignin" />
|
||||
</SModal>
|
||||
<Signin :show="showSignin" :onClose="onSignin" />
|
||||
</view>
|
||||
</Container>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user