diff --git a/pages/_app.js b/pages/_app.js index eee3dad6..0958ade8 100644 --- a/pages/_app.js +++ b/pages/_app.js @@ -32,6 +32,9 @@ import { Sakura } from '@/components/Sakura' import { StarrySky } from '@/components/StarrySky' import MusicPlayer from '@/components/MusicPlayer' import ExternalScript from '@/components/ExternalScript' +import AOS from 'aos' +import { isBrowser } from '@/lib/utils' +import 'aos/dist/aos.css' // You can also use for styles const Ackee = dynamic(() => import('@/components/Ackee'), { ssr: false }) const Gtag = dynamic(() => import('@/components/Gtag'), { ssr: false }) @@ -72,6 +75,10 @@ const MyApp = ({ Component, pageProps }) => { // 用户指定CUSTOM_FONT 则取CUSTOM_FONT_URL const FONTS_URL = BLOG.CUSTOM_FONT ? BLOG.CUSTOM_FONT_URL : DEFAULT_FONTS_URL + if (isBrowser()) { + AOS.init() + } + return ( {/* 渲染所有字体 */} diff --git a/themes/hexo/LayoutBase.js b/themes/hexo/LayoutBase.js index 7ddf46d6..59639a66 100644 --- a/themes/hexo/LayoutBase.js +++ b/themes/hexo/LayoutBase.js @@ -11,9 +11,6 @@ import Live2D from '@/components/Live2D' import LoadingCover from './components/LoadingCover' import { useGlobal } from '@/lib/global' import BLOG from '@/blog.config' -import AOS from 'aos' -import 'aos/dist/aos.css' // You can also use for styles -import { isBrowser } from '@/lib/utils' import dynamic from 'next/dynamic' const FacebookPage = dynamic( @@ -61,10 +58,6 @@ const LayoutBase = props => { return () => document.removeEventListener('scroll', scrollListener) }, [show]) - if (isBrowser()) { - AOS.init() - } - return (
diff --git a/themes/matery/LayoutBase.js b/themes/matery/LayoutBase.js index 63c5ebc9..c529c788 100644 --- a/themes/matery/LayoutBase.js +++ b/themes/matery/LayoutBase.js @@ -9,10 +9,7 @@ import Live2D from '@/components/Live2D' import LoadingCover from './components/LoadingCover' import { useGlobal } from '@/lib/global' import BLOG from '@/blog.config' -import AOS from 'aos' -import 'aos/dist/aos.css' // You can also use for styles import FloatDarkModeButton from './components/FloatDarkModeButton' -import { isBrowser } from '@/lib/utils' /** * 基础布局 采用左右两侧布局,移动端使用顶部导航栏 @@ -45,10 +42,6 @@ const LayoutBase = props => { return () => document.removeEventListener('scroll', scrollListener) }, [show]) - if (isBrowser()) { - AOS.init() - } - return (
diff --git a/themes/next/LayoutBase.js b/themes/next/LayoutBase.js index db2edcc6..81cb5037 100644 --- a/themes/next/LayoutBase.js +++ b/themes/next/LayoutBase.js @@ -14,9 +14,6 @@ import smoothscroll from 'smoothscroll-polyfill' import CONFIG_NEXT from './config_next' import Live2D from '@/components/Live2D' import BLOG from '@/blog.config' -import AOS from 'aos' -import 'aos/dist/aos.css' // You can also use for styles -import { isBrowser } from '@/lib/utils' /** * 基础布局 采用左右两侧布局,移动端使用顶部导航栏 @@ -62,10 +59,6 @@ const LayoutBase = (props) => { return () => document.removeEventListener('scroll', scrollListener) }, [show]) - if (isBrowser()) { - AOS.init() - } - return (<>