mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-06-01 07:26:47 +00:00
404页面处理
This commit is contained in:
@@ -1,6 +1,22 @@
|
|||||||
import LayoutBase from './LayoutBase'
|
import LayoutBase from './LayoutBase'
|
||||||
|
import { useRouter } from 'next/router'
|
||||||
|
import { useEffect } from 'react'
|
||||||
|
|
||||||
export const Layout404 = props => {
|
export const Layout404 = props => {
|
||||||
|
const router = useRouter()
|
||||||
|
useEffect(() => {
|
||||||
|
// 延时3秒如果加载失败就返回首页
|
||||||
|
setTimeout(() => {
|
||||||
|
if (window) {
|
||||||
|
const article = document.getElementById('container')
|
||||||
|
if (!article) {
|
||||||
|
router.push('/').then(() => {
|
||||||
|
console.log('找不到页面', router.asPath)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 3000)
|
||||||
|
})
|
||||||
return (
|
return (
|
||||||
<LayoutBase {...props}>
|
<LayoutBase {...props}>
|
||||||
<div className="text-black w-full h-screen text-center justify-center content-center items-center flex flex-col">
|
<div className="text-black w-full h-screen text-center justify-center content-center items-center flex flex-col">
|
||||||
|
|||||||
Reference in New Issue
Block a user