From 2f60e128a51433315c865892c6670aff2fe746a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9B=AE=E6=A3=83?= Date: Sat, 16 Nov 2024 12:34:53 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20=E8=B0=83=E6=95=B4=E5=88=B7?= =?UTF-8?q?=E6=96=B0=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/common/PostTopic.vue | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/pages/common/PostTopic.vue b/src/pages/common/PostTopic.vue index 4aeb1e12..9623173e 100644 --- a/src/pages/common/PostTopic.vue +++ b/src/pages/common/PostTopic.vue @@ -101,17 +101,7 @@ const sortList = computed(() => { ]; }); -onMounted(async () => await firstLoad()); -watch( - () => curGame.value, - async () => await firstLoad(), -); -watch( - () => curSortType.value, - async () => await firstLoad(), -); - -async function firstLoad(): Promise { +onMounted(async () => { showLoading.start(`正在加载话题${topic}信息`); const info = await Mys.Post.getTopicFullInfo(gid, topic); if ("retcode" in info) { @@ -124,8 +114,22 @@ async function firstLoad(): Promise { curGame.value = toRaw(info.game_info_list.find((i) => i.id === curGid.value)); } if (curGame.value === undefined) curGame.value = info.game_info_list[0]; - curGid.value = curGame.value.id; - showLoading.update(`正在加载${curGame.value.name}帖子列表`); + await firstLoad(); +}); +watch( + () => curGame.value, + async () => { + if (curGame.value) curGid.value = curGame.value.id; + await firstLoad(); + }, +); +watch( + () => curSortType.value, + async () => await firstLoad(), +); + +async function firstLoad(): Promise { + if (curGame.value) showLoading.update(`正在加载${curGame.value.name}帖子列表`); const postList = await Mys.Post.getTopicPostList(curGid.value, topic, curSortType.value); if ("retcode" in postList) { showLoading.end();