更换事件

This commit is contained in:
kron
2025-08-25 13:47:32 +08:00
parent 7a9439567f
commit 448df06daf
28 changed files with 52 additions and 52 deletions

View File

@@ -1,5 +1,5 @@
<script setup>
import { ref, watch, onMounted, onUnmounted } from "vue";
import { ref, watch, onMounted, onBeforeUnmount } from "vue";
import { onShow } from "@dcloudio/uni-app";
import { isGamingAPI, getCurrentGameAPI } from "@/apis";
import { debounce } from "@/util";
@@ -49,7 +49,7 @@ const gameOver = () => {
onMounted(() => {
uni.$on("game-over", gameOver);
});
onUnmounted(() => {
onBeforeUnmount(() => {
uni.$off("game-over", gameOver);
});
</script>

View File

@@ -1,5 +1,5 @@
<script setup>
import { ref, onMounted, onUnmounted } from "vue";
import { ref, onMounted, onBeforeUnmount } from "vue";
import { onShow } from "@dcloudio/uni-app";
import AppBackground from "@/components/AppBackground.vue";
import Header from "@/components/Header.vue";
@@ -55,7 +55,7 @@ onMounted(() => {
const menuBtnInfo = uni.getMenuButtonBoundingClientRect();
capsuleHeight.value = menuBtnInfo.top - 9;
});
onUnmounted(() => {
onBeforeUnmount(() => {
// const pages = getCurrentPages();
// const currentPage = pages[pages.length - 1];
// uni.setStorageSync("last-route", currentPage.route);

View File

@@ -1,5 +1,5 @@
<script setup>
import { ref, watch, onMounted, onUnmounted } from "vue";
import { ref, watch, onMounted } from "vue";
import { getPointBookConfigAPI } from "@/apis";
const props = defineProps({
itemIndex: {

View File

@@ -1,5 +1,5 @@
<script setup>
import { ref, onMounted, onUnmounted } from "vue";
import { ref, onMounted, onBeforeUnmount } from "vue";
import HeaderProgress from "@/components/HeaderProgress.vue";
const props = defineProps({
@@ -48,7 +48,7 @@ onMounted(() => {
showProgress.value = true;
}
});
onUnmounted(() => {
onBeforeUnmount(() => {
uni.$off("update-header-loading", updateLoading);
});
</script>

View File

@@ -1,5 +1,5 @@
<script setup>
import { ref, watch, onMounted, onUnmounted } from "vue";
import { ref, watch, onMounted, onBeforeUnmount } from "vue";
import audioManager from "@/audioManager";
import { MESSAGETYPES } from "@/constants";
import useStore from "@/store";
@@ -110,7 +110,7 @@ onMounted(() => {
uni.$on("play-sound", playSound);
});
onUnmounted(() => {
onBeforeUnmount(() => {
uni.$off("update-tips", onUpdateTips);
uni.$off("socket-inbox", onReceiveMessage);
uni.$off("play-sound", playSound);

View File

@@ -1,5 +1,5 @@
<script setup>
import { ref, onMounted, onUnmounted, watch } from "vue";
import { ref, onMounted, onBeforeUnmount, watch } from "vue";
const props = defineProps({
stopMatch: {
type: Function,
@@ -94,7 +94,7 @@ onMounted(() => {
textStyles.value = getTextStyle(totalTop.value);
}, 40);
});
onUnmounted(() => {
onBeforeUnmount(() => {
if (timer.value) clearInterval(timer.value);
});
</script>

View File

@@ -1,5 +1,5 @@
<script setup>
import { ref, onMounted, onUnmounted } from "vue";
import { ref, onMounted, onBeforeUnmount } from "vue";
const props = defineProps({
isFinal: {
type: Boolean,
@@ -40,7 +40,7 @@ function startCount() {
onMounted(() => {
startCount();
});
onUnmounted(() => {
onBeforeUnmount(() => {
if (tiemr.value) clearInterval(tiemr.value);
});
</script>

View File

@@ -1,5 +1,5 @@
<script setup>
import { ref, watch, onMounted, onUnmounted } from "vue";
import { ref, watch, onMounted, onBeforeUnmount } from "vue";
const props = defineProps({
rowCount: {
type: Number,
@@ -42,7 +42,7 @@ onMounted(() => {
bgIndex.value = bgIndex.value === 0 ? 1 : 0;
}, 200);
});
onUnmounted(() => {
onBeforeUnmount(() => {
if (timer.value) {
clearInterval(timer.value);
}

View File

@@ -1,5 +1,5 @@
<script setup>
import { ref, watch, onMounted, onUnmounted } from "vue";
import { ref, watch, onMounted, onBeforeUnmount } from "vue";
import audioManager from "@/audioManager";
import { MESSAGETYPES } from "@/constants";
import useStore from "@/store";
@@ -173,7 +173,7 @@ onMounted(() => {
uni.$on("play-sound", playSound);
});
onUnmounted(() => {
onBeforeUnmount(() => {
uni.$off("update-ramain", updateRemain);
uni.$off("socket-inbox", onReceiveMessage);
uni.$off("play-sound", playSound);

View File

@@ -1,5 +1,5 @@
<script setup>
import { ref, watch, onMounted, onUnmounted } from "vue";
import { ref, watch, onMounted, onBeforeUnmount } from "vue";
import { RoundGoldImages } from "@/constants";
const props = defineProps({
tips: {
@@ -52,7 +52,7 @@ onMounted(() => {
uni.$on("update-ramain", updateRemain);
});
onUnmounted(() => {
onBeforeUnmount(() => {
uni.$off("update-ramain", updateRemain);
if (timer.value) clearInterval(timer.value);
});

View File

@@ -1,5 +1,5 @@
<script setup>
import { ref, watch, onMounted, onUnmounted } from "vue";
import { ref, watch, onMounted, onBeforeUnmount } from "vue";
const props = defineProps({
start: {
type: Boolean,
@@ -32,7 +32,7 @@ onMounted(() => {
const deviceInfo = uni.getDeviceInfo();
isIos.value = deviceInfo.osName === "ios";
});
onUnmounted(() => {
onBeforeUnmount(() => {
if (timer.value) clearInterval(timer.value);
});
</script>

View File

@@ -1,5 +1,5 @@
<script setup>
import { ref, onMounted, onUnmounted } from "vue";
import { ref, onMounted, onBeforeUnmount } from "vue";
import Guide from "@/components/Guide.vue";
import BowPower from "@/components/BowPower.vue";
import Avatar from "@/components/Avatar.vue";
@@ -38,7 +38,7 @@ onMounted(() => {
}, 1000);
uni.$on("update-timer", updateTimer);
});
onUnmounted(() => {
onBeforeUnmount(() => {
if (timer.value) clearInterval(timer.value);
uni.$off("update-timer", updateTimer);
});
@@ -66,7 +66,7 @@ onMounted(() => {
if (envVersion !== "release") showsimul.value = true;
});
onUnmounted(() => {
onBeforeUnmount(() => {
uni.$off("socket-inbox", onReceiveMessage);
});
</script>

View File

@@ -1,5 +1,5 @@
<script setup>
import { ref, watch, onMounted, onUnmounted } from "vue";
import { ref, watch, onMounted, onBeforeUnmount } from "vue";
const props = defineProps({
countdown: {
type: Number,
@@ -26,7 +26,7 @@ onMounted(() => {
}, 300);
uni.$on("update-timer", updateTimer);
});
onUnmounted(() => {
onBeforeUnmount(() => {
if (timer.value) clearInterval(timer.value);
uni.$off("update-timer", updateTimer);
});

View File

@@ -1,5 +1,5 @@
<script setup>
import { ref, onMounted, onUnmounted } from "vue";
import { ref, onMounted, onBeforeUnmount } from "vue";
import useStore from "@/store";
import { storeToRefs } from "pinia";
const store = useStore();
@@ -44,7 +44,7 @@ onMounted(async () => {
}, 1000);
});
onUnmounted(() => {
onBeforeUnmount(() => {
if (timer.value) clearTimeout(timer.value);
});
</script>

View File

@@ -1,5 +1,5 @@
<script setup>
import { ref, onMounted, onUnmounted } from "vue";
import { ref, onMounted } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import Avatar from "@/components/Avatar.vue";
import UserUpgrade from "@/components/UserUpgrade.vue";

View File

@@ -1,5 +1,5 @@
<script setup>
import { ref, watch, onMounted, onUnmounted, nextTick } from "vue";
import { ref, watch, onMounted, onBeforeUnmount } from "vue";
import { onLoad, onShow, onHide } from "@dcloudio/uni-app";
import Container from "@/components/Container.vue";
import PlayerSeats from "@/components/PlayerSeats.vue";
@@ -245,7 +245,7 @@ onMounted(() => {
uni.$on("socket-inbox", onReceiveMessage);
});
onUnmounted(() => {
onBeforeUnmount(() => {
if (refreshRoomTimer.value) clearInterval(refreshRoomTimer.value);
uni.setKeepScreenOn({
keepScreenOn: false,

View File

@@ -1,5 +1,5 @@
<script setup>
import { ref, onMounted, onUnmounted } from "vue";
import { ref, onMounted, onBeforeUnmount } from "vue";
import Container from "@/components/Container.vue";
import Avatar from "@/components/Avatar.vue";
import SButton from "@/components/SButton.vue";
@@ -67,7 +67,7 @@ const toOrderPage = () => {
});
};
onUnmounted(() => {
onBeforeUnmount(() => {
if (timer.value) clearInterval(timer.value);
});
</script>

View File

@@ -1,5 +1,5 @@
<script setup>
import { ref, onMounted, onUnmounted } from "vue";
import { ref, onMounted, onBeforeUnmount } from "vue";
import Guide from "@/components/Guide.vue";
import SButton from "@/components/SButton.vue";
import Swiper from "@/components/Swiper.vue";
@@ -100,7 +100,7 @@ onMounted(() => {
uni.$on("socket-inbox", onReceiveMessage);
});
onUnmounted(() => {
onBeforeUnmount(() => {
uni.setKeepScreenOn({
keepScreenOn: false,
});

View File

@@ -1,5 +1,5 @@
<script setup>
import { ref, onMounted, onUnmounted } from "vue";
import { ref, onMounted, onBeforeUnmount } from "vue";
import { onLoad, onShow, onHide } from "@dcloudio/uni-app";
import Container from "@/components/Container.vue";
import Matching from "@/components/Matching.vue";
@@ -59,7 +59,7 @@ onMounted(() => {
uni.$on("socket-inbox", onReceiveMessage);
});
onUnmounted(() => {
onBeforeUnmount(() => {
uni.setKeepScreenOn({
keepScreenOn: false,
});

View File

@@ -1,5 +1,5 @@
<script setup>
import { ref, watch, onMounted, onUnmounted } from "vue";
import { ref, watch, onMounted, onBeforeUnmount } from "vue";
import { onLoad, onShow, onHide } from "@dcloudio/uni-app";
import Container from "@/components/Container.vue";
import BowTarget from "@/components/BowTarget.vue";
@@ -160,7 +160,7 @@ onMounted(() => {
});
uni.$on("socket-inbox", onReceiveMessage);
});
onUnmounted(() => {
onBeforeUnmount(() => {
uni.setKeepScreenOn({
keepScreenOn: false,
});

View File

@@ -1,5 +1,5 @@
<script setup>
import { ref, onMounted, onUnmounted } from "vue";
import { ref, onMounted, onBeforeUnmount } from "vue";
import Container from "@/components/Container.vue";
import SButton from "@/components/SButton.vue";
import { payOrderAPI, cancelOrderListAPI, getHomeData } from "@/apis";
@@ -30,7 +30,7 @@ onMounted(() => {
uni.$on("socket-inbox", onReceiveMessage);
});
onUnmounted(() => {
onBeforeUnmount(() => {
uni.$off("socket-inbox", onReceiveMessage);
});

View File

@@ -1,5 +1,5 @@
<script setup>
import { ref, onMounted, onUnmounted } from "vue";
import { ref, onMounted } from "vue";
import { onShow } from "@dcloudio/uni-app";
import Container from "@/components/Container.vue";
import EditOption from "@/components/EditOption.vue";

View File

@@ -1,5 +1,5 @@
<script setup>
import { ref, onMounted, onUnmounted } from "vue";
import { ref, onMounted } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import Container from "@/components/Container.vue";
import BowTargetEdit from "@/components/BowTargetEdit.vue";

View File

@@ -1,5 +1,5 @@
<script setup>
import { ref, onMounted, onUnmounted } from "vue";
import { ref, onMounted } from "vue";
import Container from "@/components/Container.vue";
import SModal from "@/components/SModal.vue";
import EditOption from "@/components/EditOption.vue";

View File

@@ -1,5 +1,5 @@
<script setup>
import { ref, onMounted, onUnmounted } from "vue";
import { ref, onMounted, onBeforeUnmount } from "vue";
import Container from "@/components/Container.vue";
import ShootProgress from "@/components/ShootProgress.vue";
import BowTarget from "@/components/BowTarget.vue";
@@ -98,7 +98,7 @@ onMounted(() => {
uni.$on("socket-inbox", onReceiveMessage);
});
onUnmounted(() => {
onBeforeUnmount(() => {
uni.setKeepScreenOn({
keepScreenOn: false,
});

View File

@@ -1,5 +1,5 @@
<script setup>
import { ref, onMounted, onUnmounted } from "vue";
import { ref, onMounted, onBeforeUnmount } from "vue";
import Container from "@/components/Container.vue";
import ShootProgress from "@/components/ShootProgress.vue";
import BowTarget from "@/components/BowTarget.vue";
@@ -91,7 +91,7 @@ onMounted(() => {
uni.$on("socket-inbox", onReceiveMessage);
});
onUnmounted(() => {
onBeforeUnmount(() => {
uni.setKeepScreenOn({
keepScreenOn: false,
});

View File

@@ -1,5 +1,5 @@
<script setup>
import { ref, onMounted, onUnmounted, nextTick } from "vue";
import { ref, onMounted, onBeforeUnmount, nextTick } from "vue";
import { onLoad, onShow, onHide } from "@dcloudio/uni-app";
import Container from "@/components/Container.vue";
import BattleHeader from "@/components/BattleHeader.vue";
@@ -271,7 +271,7 @@ onMounted(() => {
});
uni.$on("socket-inbox", onReceiveMessage);
});
onUnmounted(() => {
onBeforeUnmount(() => {
uni.setKeepScreenOn({
keepScreenOn: false,
});

View File

@@ -1,5 +1,5 @@
<script setup>
import { ref, onMounted, onUnmounted, nextTick } from "vue";
import { ref, onMounted, onBeforeUnmount, nextTick } from "vue";
import { onLoad, onShow, onHide } from "@dcloudio/uni-app";
import Container from "@/components/Container.vue";
import BattleHeader from "@/components/BattleHeader.vue";
@@ -270,7 +270,7 @@ onMounted(() => {
});
uni.$on("socket-inbox", onReceiveMessage);
});
onUnmounted(() => {
onBeforeUnmount(() => {
uni.setKeepScreenOn({
keepScreenOn: false,
});