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();