mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-20 15:09:40 +00:00
gitbook
This commit is contained in:
@@ -4,7 +4,6 @@ import { useRouter } from 'next/router'
|
||||
import BLOG from '@/blog.config'
|
||||
import { ALL_THEME, initDarkMode } from '@/themes/theme'
|
||||
import NProgress from 'nprogress'
|
||||
import LoadingCover from '@/components/LoadingCover'
|
||||
import { getQueryVariable, isBrowser } from './utils'
|
||||
|
||||
const GlobalContext = createContext()
|
||||
@@ -22,7 +21,7 @@ export function GlobalContextProvider({ children }) {
|
||||
const [theme, setTheme] = useState(BLOG.THEME) // 默认博客主题
|
||||
const [isDarkMode, updateDarkMode] = useState(BLOG.APPEARANCE === 'dark') // 默认深色模式
|
||||
const [onLoading, setOnLoading] = useState(false) // 抓取文章数据
|
||||
const [onReading, setOnReading] = useState(false) // 网页资源加载
|
||||
// const [onReading, setOnReading] = useState(false) // 网页资源加载
|
||||
|
||||
useEffect(() => {
|
||||
initLocale(lang, locale, updateLang, updateLocale)
|
||||
@@ -34,7 +33,7 @@ export function GlobalContextProvider({ children }) {
|
||||
// setOnReading(true)
|
||||
}
|
||||
// 监听页面元素加载完
|
||||
setOnReading(false)
|
||||
// setOnReading(false)
|
||||
window.addEventListener('beforeunload', handleBeforeUnload)
|
||||
return () => {
|
||||
window.removeEventListener('beforeunload', handleBeforeUnload)
|
||||
@@ -88,10 +87,8 @@ export function GlobalContextProvider({ children }) {
|
||||
updateDarkMode,
|
||||
theme,
|
||||
setTheme,
|
||||
switchTheme,
|
||||
setOnReading
|
||||
switchTheme
|
||||
}}>
|
||||
<LoadingCover onReading={onReading} setOnReading={setOnReading}/>
|
||||
{children}
|
||||
</GlobalContext.Provider>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user