mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-21 15:09:43 +00:00
修复部分NOTION_CONFIG读取问题
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user