添加游戏结束,隐藏返回按钮

This commit is contained in:
kron
2025-07-19 16:41:23 +08:00
parent ca317d62e0
commit 9e83bf89f7
2 changed files with 13 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
<script setup>
import { ref, onMounted } from "vue";
import { ref, onMounted, onUnmounted } from "vue";
import { onShow } from "@dcloudio/uni-app";
import { isGamingAPI, getCurrentGameAPI } from "@/apis";
const props = defineProps({
@@ -20,6 +20,15 @@ const onClick = async () => {
const result = await getCurrentGameAPI();
}
};
const gameOver = () => {
show.value = false;
};
onMounted(() => {
uni.$on("game-over", gameOver);
});
onUnmounted(() => {
uni.$off("game-over", gameOver);
});
</script>
<template>