mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-20 23:16:49 +00:00
封装isBroswer()
This commit is contained in:
@@ -5,6 +5,7 @@ import { useGlobal } from '@/lib/global'
|
||||
import * as ThemeMap from '@/themes'
|
||||
import React from 'react'
|
||||
import { useRouter } from 'next/router'
|
||||
import { isBrowser } from '@/lib/utils'
|
||||
|
||||
/**
|
||||
* 根据notion的slug访问页面,针对类型为Page的页面
|
||||
@@ -20,7 +21,7 @@ const Slug = props => {
|
||||
changeLoadingState(true)
|
||||
const router = useRouter()
|
||||
setTimeout(() => {
|
||||
if (typeof document !== 'undefined') {
|
||||
if (isBrowser()) {
|
||||
const article = document.getElementById('container')
|
||||
if (!article) {
|
||||
router.push('/404').then(() => {
|
||||
|
||||
@@ -6,6 +6,7 @@ import * as ThemeMap from '@/themes'
|
||||
import React from 'react'
|
||||
import { idToUuid } from 'notion-utils'
|
||||
import { useRouter } from 'next/router'
|
||||
import { isBrowser } from '@/lib/utils'
|
||||
|
||||
/**
|
||||
* 根据notion的slug访问页面
|
||||
@@ -21,7 +22,7 @@ const Slug = props => {
|
||||
changeLoadingState(true)
|
||||
const router = useRouter()
|
||||
setTimeout(() => {
|
||||
if (typeof document !== 'undefined') {
|
||||
if (isBrowser()) {
|
||||
const article = document.getElementById('container')
|
||||
if (!article) {
|
||||
router.push('/404').then(() => {
|
||||
|
||||
@@ -27,7 +27,7 @@ export async function getStaticProps() {
|
||||
if (BLOG.POST_LIST_STYLE !== 'page') {
|
||||
postsToShow = Array.from(allPosts)
|
||||
} else {
|
||||
postsToShow = allPosts.slice(
|
||||
postsToShow = allPosts?.slice(
|
||||
BLOG.POSTS_PER_PAGE * (page - 1),
|
||||
BLOG.POSTS_PER_PAGE * page
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user