mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-23 15:09:46 +00:00
重构优化主题异步加载
This commit is contained in:
@@ -1,21 +1,22 @@
|
||||
import { useGlobal } from '@/lib/global'
|
||||
import { useEffect } from 'react'
|
||||
|
||||
/**
|
||||
* 主题文件被加载出之前的占位符
|
||||
* @returns
|
||||
*/
|
||||
const Loading = (props) => {
|
||||
const { theme, setOnReading } = useGlobal()
|
||||
// const { theme, setOnReading } = useGlobal()
|
||||
// console.log('开启遮罩')
|
||||
// setOnReading(true)
|
||||
|
||||
useEffect(() => {
|
||||
// 返回一个函数,在组件销毁时设置 onReading 为 false
|
||||
return () => {
|
||||
setTimeout(() => {
|
||||
setOnReading(false)
|
||||
}, 500)
|
||||
}
|
||||
}, [theme])
|
||||
// useEffect(() => {
|
||||
// // 返回一个函数,在组件销毁时设置 onReading 为 false
|
||||
// return () => {
|
||||
// setTimeout(() => {
|
||||
// console.log('关闭遮罩')
|
||||
// setOnReading(false)
|
||||
// }, 500)
|
||||
// }
|
||||
// })
|
||||
|
||||
return <div className="w-screen h-screen flex justify-center items-center bg-black">
|
||||
<i className='mr-5 fas fa-spinner animate-spin text-2xl' />
|
||||
|
||||
Reference in New Issue
Block a user