mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-12 09:18:14 +08:00
🎨 调整刷新逻辑
This commit is contained in:
@@ -101,17 +101,7 @@ const sortList = computed<SortSelect[]>(() => {
|
|||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
onMounted(async () => await firstLoad());
|
onMounted(async () => {
|
||||||
watch(
|
|
||||||
() => curGame.value,
|
|
||||||
async () => await firstLoad(),
|
|
||||||
);
|
|
||||||
watch(
|
|
||||||
() => curSortType.value,
|
|
||||||
async () => await firstLoad(),
|
|
||||||
);
|
|
||||||
|
|
||||||
async function firstLoad(): Promise<void> {
|
|
||||||
showLoading.start(`正在加载话题${topic}信息`);
|
showLoading.start(`正在加载话题${topic}信息`);
|
||||||
const info = await Mys.Post.getTopicFullInfo(gid, topic);
|
const info = await Mys.Post.getTopicFullInfo(gid, topic);
|
||||||
if ("retcode" in info) {
|
if ("retcode" in info) {
|
||||||
@@ -124,8 +114,22 @@ async function firstLoad(): Promise<void> {
|
|||||||
curGame.value = toRaw(info.game_info_list.find((i) => i.id === curGid.value));
|
curGame.value = toRaw(info.game_info_list.find((i) => i.id === curGid.value));
|
||||||
}
|
}
|
||||||
if (curGame.value === undefined) curGame.value = info.game_info_list[0];
|
if (curGame.value === undefined) curGame.value = info.game_info_list[0];
|
||||||
curGid.value = curGame.value.id;
|
await firstLoad();
|
||||||
showLoading.update(`正在加载${curGame.value.name}帖子列表`);
|
});
|
||||||
|
watch(
|
||||||
|
() => curGame.value,
|
||||||
|
async () => {
|
||||||
|
if (curGame.value) curGid.value = curGame.value.id;
|
||||||
|
await firstLoad();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
watch(
|
||||||
|
() => curSortType.value,
|
||||||
|
async () => await firstLoad(),
|
||||||
|
);
|
||||||
|
|
||||||
|
async function firstLoad(): Promise<void> {
|
||||||
|
if (curGame.value) showLoading.update(`正在加载${curGame.value.name}帖子列表`);
|
||||||
const postList = await Mys.Post.getTopicPostList(curGid.value, topic, curSortType.value);
|
const postList = await Mys.Post.getTopicPostList(curGid.value, topic, curSortType.value);
|
||||||
if ("retcode" in postList) {
|
if ("retcode" in postList) {
|
||||||
showLoading.end();
|
showLoading.end();
|
||||||
|
|||||||
Reference in New Issue
Block a user