diff --git a/blog.config.js b/blog.config.js index 1cbaedf8..407b68e3 100644 --- a/blog.config.js +++ b/blog.config.js @@ -39,6 +39,10 @@ const BLOG = { CONTACT_GITHUB: 'https://github.com/tangly1024', CONTACT_TELEGRAM: '', + // 悬浮挂件 + WIDGET_PET: process.env.NEXT_PUBLIC_WIDGET_PET || false, // 是否显示宠物挂件 + WIDGET_PET_LINK: 'https://cdn.jsdelivr.net/npm/live2d-widget-model-wanko@1.0.5/assets/wanko.model.json', // 挂件模型地址 @see https://github.com/xiazeyu/live2d-widget-models + // 评论互动 可同时开启 CUSDIS UTTERRANCES GITALK COMMENT_CUSDIS_APP_ID: process.env.NEXT_PUBLIC_COMMENT_CUSDIS_APP_ID || '', // data-app-id 36位 see https://cusdis.com/ COMMENT_CUSDIS_HOST: process.env.NEXT_PUBLIC_COMMENT_CUSDIS_HOST || 'https://cusdis.com', // data-host, change this if you're using self-hosted version diff --git a/themes/next/components/Live2D.js b/components/Live2D.js similarity index 53% rename from themes/next/components/Live2D.js rename to components/Live2D.js index c9ce2a1b..e82ee884 100644 --- a/themes/next/components/Live2D.js +++ b/components/Live2D.js @@ -1,21 +1,27 @@ /* eslint-disable no-undef */ -import CONFIG_NEXT from '../config_next' +import BLOG from '@/blog.config' import { loadExternalResource } from '@/lib/utils' +import { useEffect, useState } from 'react' -let hasLoad = false export default function Live2D () { - if (!CONFIG_NEXT.WIDGET_PET) { + if (!BLOG.WIDGET_PET) { return <>> } + const [init, setInit] = useState() - if (typeof window !== 'undefined' && !hasLoad) { - initLive2D() - hasLoad = true - } + // if (typeof window !== 'undefined' && !hasLoad) { + // initLive2D() + // hasLoad = true + // } - return