diff --git a/components/Comment.js b/components/Comment.js index 45bb554f..915b96ee 100644 --- a/components/Comment.js +++ b/components/Comment.js @@ -1,14 +1,13 @@ import BLOG from '@/blog.config' import dynamic from 'next/dynamic' import { useRouter } from 'next/router' -import 'gitalk/dist/gitalk.css' import Tabs from '@/components/Tabs' import { ReactCusdis } from 'react-cusdis' import { useGlobal } from '@/lib/global' const GitalkComponent = dynamic( () => { - return import('gitalk/dist/gitalk-component') + return import('@/components/Gitalk') }, { ssr: false } ) diff --git a/components/Gitalk.js b/components/Gitalk.js new file mode 100644 index 00000000..2edc44bd --- /dev/null +++ b/components/Gitalk.js @@ -0,0 +1,9 @@ +import 'gitalk/dist/gitalk.css' + +import GitalkComponent from 'gitalk/dist/gitalk-component' + +const Gitalk = props => { + return +} + +export default Gitalk diff --git a/components/Live2D.js b/components/Live2D.js index e91a3806..c763349a 100644 --- a/components/Live2D.js +++ b/components/Live2D.js @@ -17,7 +17,10 @@ export default function Live2D() { } useEffect(() => { - initLive2D() + window.addEventListener('scroll', initLive2D) + return () => { + window.removeEventListener('scroll', initLive2D) + } }, []) return @@ -27,6 +30,7 @@ export default function Live2D() { * 加载宠物 */ function initLive2D() { + window.removeEventListener('scroll', initLive2D) setTimeout(() => { // 加载 waifu.css live2d.min.js waifu-tips.js if (screen.width >= 768) { @@ -38,5 +42,5 @@ function initLive2D() { loadlive2d('live2d', BLOG.WIDGET_PET_LINK) }) } - }, 1000) + }, 300) } diff --git a/next.config.js b/next.config.js index f3bd40ae..7c8627f1 100644 --- a/next.config.js +++ b/next.config.js @@ -6,6 +6,8 @@ module.exports = withBundleAnalyzer({ webpack5: true }, images: { + // 图片压缩 + formats: ['image/avif', 'image/webp'], // 允许next/image加载的图片 域名 domains: [ 'gravatar.com', diff --git a/pages/article/[slug].js b/pages/article/[slug].js index 40fe2ef2..52a2082d 100644 --- a/pages/article/[slug].js +++ b/pages/article/[slug].js @@ -25,7 +25,7 @@ const Slug = props => { const article = document.getElementById('container') if (!article) { router.push('/404').then(() => { - console.warn('找不到页面', router.asPath) + // console.warn('找不到页面', router.asPath) }) } } diff --git a/themes/hexo/Layout404.js b/themes/hexo/Layout404.js index f64e8016..4ed0ebea 100644 --- a/themes/hexo/Layout404.js +++ b/themes/hexo/Layout404.js @@ -11,7 +11,7 @@ export const Layout404 = props => { const article = typeof document !== 'undefined' && document.getElementById('container') if (!article) { router.push('/').then(() => { - console.log('找不到页面', router.asPath) + // console.log('找不到页面', router.asPath) }) } } diff --git a/themes/hexo/components/Header.js b/themes/hexo/components/Header.js index c1e4e71f..9430c1db 100644 --- a/themes/hexo/components/Header.js +++ b/themes/hexo/components/Header.js @@ -103,7 +103,7 @@ const Header = props => { className="duration-500 md:bg-fixed w-full bg-cover bg-center h-screen bg-black text-white" style={{ backgroundImage: - `linear-gradient(rgba(0, 0, 0, 0.8), rgba(0,0,0,0.2), rgba(0, 0, 0, 0.8) ),url("${siteInfo?.pageCover}")` + `linear-gradient(rgba(0, 0, 0, 0.8), rgba(0,0,0,0.2), rgba(0,0,0,0.2), rgba(0,0,0,0.2), rgba(0, 0, 0, 0.8) ),url("${siteInfo?.pageCover}")` }} >
diff --git a/themes/next/Layout404.js b/themes/next/Layout404.js index 530d2c53..a9d18559 100644 --- a/themes/next/Layout404.js +++ b/themes/next/Layout404.js @@ -11,7 +11,7 @@ export const Layout404 = props => { const article = typeof document !== 'undefined' && document.getElementById('container') if (!article) { router.push('/').then(() => { - console.log('找不到页面', router.asPath) + // console.log('找不到页面', router.asPath) }) } }