fix(路由): 修复分页路由参数处理问题

修改路由更新逻辑,当页码小于等于1时移除p参数,避免URL中出现冗余参数。同时移除初始加载时的路由更新调用,防止重复操作。

docs: 更新文档说明
更新后台和评论端的更新说明,明确官方托管的使用方式
This commit is contained in:
anghunk
2026-01-21 11:23:47 +08:00
parent c95ca722bc
commit a9c8f0b541
3 changed files with 12 additions and 8 deletions

View File

@@ -274,8 +274,13 @@ async function loadComments(page?: number) {
}
function updateRoutePage(page: number) {
const query = { ...route.query, p: String(page) };
router.replace({ query });
const query: Record<string, any> = { ...route.query };
if (page <= 1) {
delete query.p;
} else {
query.p = String(page);
}
router.push({ query });
}
async function goPage(page: number) {
@@ -365,7 +370,6 @@ onMounted(() => {
initialPage = Math.floor(value);
}
}
updateRoutePage(initialPage);
loadComments(initialPage);
});
</script>