模拟射箭添加环境判断

This commit is contained in:
kron
2025-08-09 12:02:36 +08:00
parent 975f791dfb
commit ca6cb989c7
2 changed files with 19 additions and 3 deletions

View File

@@ -20,6 +20,7 @@ const arrow = ref({});
const power = ref(0);
const distance = ref(0);
const debugInfo = ref("");
const showsimul = ref(false);
async function onReceiveMessage(messages = []) {
messages.forEach((msg) => {
@@ -39,6 +40,9 @@ const simulShoot = async () => {
onMounted(() => {
checkConnection();
uni.$on("socket-inbox", onReceiveMessage);
const accountInfo = uni.getAccountInfoSync();
const envVersion = accountInfo.miniProgram.envVersion;
if (envVersion !== "release") showsimul.value = true;
});
onUnmounted(() => {
@@ -84,7 +88,12 @@ onUnmounted(() => {
</view>
<!-- <view class="debug-text">{{ debugInfo }}</view> -->
<view>
<view class="simul" @click="simulShoot" :style="{ color: '#fff' }">
<view
class="simul"
@click="simulShoot"
:style="{ color: '#fff' }"
v-if="showsimul"
>
模拟射箭
</view>
</view>