mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-21 07:26:49 +00:00
feature:
不蒜子调整
This commit is contained in:
@@ -6,29 +6,17 @@ import 'rc-dropdown/assets/index.css'
|
||||
import 'prismjs/themes/prism-okaidia.css'
|
||||
import 'katex/dist/katex.min.css'
|
||||
import dynamic from 'next/dynamic'
|
||||
import { GlobalContextProvider, handleRouteChange } from '@/lib/global'
|
||||
import { useEffect } from 'react'
|
||||
import { useRouter } from 'next/router'
|
||||
import { GlobalContextProvider } from '@/lib/global'
|
||||
import { config } from '@fortawesome/fontawesome-svg-core'
|
||||
import '@fortawesome/fontawesome-svg-core/styles.css'
|
||||
config.autoAddCss = false
|
||||
|
||||
const Ackee = dynamic(() => import('@/components/Ackee'), { ssr: false })
|
||||
const Gtag = dynamic(() => import('@/components/Gtag'), { ssr: false })
|
||||
const Busuanzi = dynamic(() => import('@/components/Busuanzi'), { ssr: false })
|
||||
const GoogleAdsense = dynamic(() => import('@/components/GoogleAdsense'), { ssr: false })
|
||||
|
||||
const MyApp = ({ Component, pageProps }) => {
|
||||
// 全局监听路由变化
|
||||
const router = useRouter()
|
||||
useEffect(() => {
|
||||
handleRouteChange(router.pathname)
|
||||
const routerListener = (url) => {
|
||||
handleRouteChange(url)
|
||||
}
|
||||
router.events.on('routeChangeComplete', routerListener)
|
||||
return () => {
|
||||
router.events.off('routeChangeComplete', routerListener)
|
||||
}
|
||||
})
|
||||
return (
|
||||
<GlobalContextProvider>
|
||||
{BLOG.isProd && BLOG?.analytics?.provider === 'ackee' && (
|
||||
@@ -38,6 +26,8 @@ const MyApp = ({ Component, pageProps }) => {
|
||||
/>
|
||||
)}
|
||||
{BLOG.isProd && BLOG?.analytics?.provider === 'ga' && <Gtag />}
|
||||
{BLOG.analytics.busuanzi && <Busuanzi/>}
|
||||
{BLOG.googleAdsenseId && <GoogleAdsense/>}
|
||||
<Component {...pageProps} />
|
||||
</GlobalContextProvider>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user