退出房间优化

This commit is contained in:
kron
2025-06-17 16:42:53 +08:00
parent 67825d2b24
commit 9c6964597e
3 changed files with 61 additions and 8 deletions

View File

@@ -7,11 +7,15 @@ const store = useStore();
const { device } = storeToRefs(store);
const isIos = ref(true);
defineProps({
const props = defineProps({
title: {
type: String,
default: "",
},
onBack: {
type: Function,
default: null,
},
});
const simulShoot = async () => {
@@ -20,6 +24,11 @@ const simulShoot = async () => {
}
};
const onClick = () => {
if (props.onBack) props.onBack();
else uni.navigateBack();
};
onMounted(() => {
const deviceInfo = uni.getDeviceInfo();
isIos.value = deviceInfo.osName === "ios";
@@ -28,9 +37,9 @@ onMounted(() => {
<template>
<view class="container" :style="{ paddingTop: isIos ? '35px' : '25px' }">
<navigator open-type="navigateBack" class="back-btn">
<view class="back-btn" @click="onClick">
<image src="../static/back.png" mode="widthFix" />
</navigator>
</view>
<text>{{ title }}</text>
<view class="simul" @click="simulShoot">模拟射箭</view>
</view>