mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-06-02 15:10:16 +00:00
fukasawa - adsense
This commit is contained in:
@@ -2,6 +2,10 @@ import BLOG from '@/blog.config'
|
||||
import { useRouter } from 'next/router'
|
||||
import { useEffect } from 'react'
|
||||
|
||||
/**
|
||||
* 初始化谷歌广告
|
||||
* @returns
|
||||
*/
|
||||
export default function GoogleAdsense() {
|
||||
const initGoogleAdsense = () => {
|
||||
setTimeout(() => {
|
||||
@@ -21,12 +25,8 @@ export default function GoogleAdsense() {
|
||||
}
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
useEffect(() => {
|
||||
router.events.on('routeChangeComplete', initGoogleAdsense)
|
||||
return () => {
|
||||
router.events.off('routeChangeComplete', initGoogleAdsense)
|
||||
}
|
||||
initGoogleAdsense()
|
||||
}, [router])
|
||||
|
||||
return null
|
||||
|
||||
Reference in New Issue
Block a user