From c17339bab57802e5e2256f5a392aa4e2639fd059 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9B=AE=E6=A3=83?= Date: Sun, 17 Nov 2024 11:29:40 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E8=B7=B3=E8=BD=AC=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/common/PostForum.vue | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/pages/common/PostForum.vue b/src/pages/common/PostForum.vue index 9368ef19..98ab90dd 100644 --- a/src/pages/common/PostForum.vue +++ b/src/pages/common/PostForum.vue @@ -183,10 +183,12 @@ const curForumLabel = ref(""); const posts = ref([]); const search = ref(""); const showSearch = ref(false); +const firstLoad = ref(false); onMounted(async () => { if (gid && typeof gid === "string") curGid.value = Number(gid); if (forum && typeof forum === "string") curForum.value = Number(forum); + firstLoad.value = true; showLoading.start(`正在获取${getGameName(curGid.value)}帖子数据...`); const gameLabel = getGameLabel(curGid.value); const forumLabel = getForumLabel(curGid.value, curForum.value); @@ -198,12 +200,13 @@ onMounted(async () => { watch( () => curGid.value, - async (newVal: number) => { - const forums = getGameForums(newVal); + () => { + const forums = getGameForums(curGid.value); const forumFind = forums.find((item) => item.text === curForumLabel.value); + if (!firstLoad.value) return; if (forumFind) curForum.value = forumFind.value; else curForum.value = forums[0].value; - showSnackbar.success(`已将分区切换到 ${getGameLabel(newVal)}`); + showSnackbar.success(`已将分区切换到 ${getGameLabel(curGid.value)}`); }, ); watch(