修复部分NOTION_CONFIG读取问题

This commit is contained in:
tangly1024.com
2024-05-15 14:55:14 +08:00
parent 70e53649b3
commit 517a967640
44 changed files with 911 additions and 565 deletions

View File

@@ -11,21 +11,18 @@ import BlogItem from './BlogItem'
*/
export const BlogListScroll = props => {
const { posts } = props
const { locale } = useGlobal()
const { locale, NOTION_CONFIG } = useGlobal()
const [page, updatePage] = useState(1)
const POSTS_PER_PAGE = siteConfig('POSTS_PER_PAGE', 12, NOTION_CONFIG)
let hasMore = false
const postsToShow = posts
? Object.assign(posts).slice(
0,
parseInt(siteConfig('POSTS_PER_PAGE')) * page
)
? Object.assign(posts).slice(0, POSTS_PER_PAGE * page)
: []
if (posts) {
const totalCount = posts.length
hasMore = page * parseInt(siteConfig('POSTS_PER_PAGE')) < totalCount
hasMore = page * POSTS_PER_PAGE < totalCount
}
const handleGetMore = () => {
if (!hasMore) return