From 1f3ac7f5ae2d64a46e70ce263966f0014743eafb Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Wed, 7 Jun 2023 18:43:54 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=87=E6=B8=A1=E5=8A=A8=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/Loading.js | 20 +++----------------- pages/_document.js | 22 ++++++++++++---------- 2 files changed, 15 insertions(+), 27 deletions(-) diff --git a/components/Loading.js b/components/Loading.js index 1cf295cd..d02ab07e 100644 --- a/components/Loading.js +++ b/components/Loading.js @@ -1,25 +1,11 @@ /** - * 主题文件被加载出之前的占位符 + * 异步文件加载过程中的占位符 * @returns */ const Loading = (props) => { -// const { theme, setOnReading } = useGlobal() - // console.log('开启遮罩') - // setOnReading(true) - - // useEffect(() => { - // // 返回一个函数,在组件销毁时设置 onReading 为 false - // return () => { - // setTimeout(() => { - // console.log('关闭遮罩') - // setOnReading(false) - // }, 500) - // } - // }) - - return
- + return
+
} export default Loading diff --git a/pages/_document.js b/pages/_document.js index 0e762a82..d9e0b447 100644 --- a/pages/_document.js +++ b/pages/_document.js @@ -2,6 +2,7 @@ import Document, { Html, Head, Main, NextScript } from 'next/document' import BLOG from '@/blog.config' import CommonScript from '@/components/CommonScript' +import Loading from '@/components/Loading' class MyDocument extends Document { static async getInitialProps(ctx) { @@ -11,17 +12,18 @@ class MyDocument extends Document { render() { return ( - - - - - + + + + + - -
- - - + +
+ + + + ) } }