[fix] category 文章数目与标签数目不对的问题,优化分页

This commit is contained in:
expoli
2023-01-19 21:44:05 +08:00
parent 263338fbca
commit 664f9577c6
2 changed files with 2 additions and 2 deletions

View File

@@ -43,7 +43,7 @@ export async function getStaticProps({ params: { category } }) {
if (BLOG.POST_LIST_STYLE === 'scroll') {
// 滚动列表 给前端返回所有数据
} else if (BLOG.POST_LIST_STYLE === 'page') {
props.posts = props.posts?.slice(0, BLOG.POSTS_PER_PAGE - 1)
props.posts = props.posts?.slice(0, BLOG.POSTS_PER_PAGE)
}
delete props.allPages

View File

@@ -38,7 +38,7 @@ export async function getStaticProps({ params: { category, page } }) {
// 处理文章页数
props.postCount = props.posts.length
// 处理分页
props.posts = props.posts.slice(BLOG.POSTS_PER_PAGE * (page - 1), BLOG.POSTS_PER_PAGE * page - 1)
props.posts = props.posts.slice(BLOG.POSTS_PER_PAGE * (page - 1), BLOG.POSTS_PER_PAGE * page)
delete props.allPages
props.page = page