mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-06-04 23:16:53 +00:00
延迟加载宠物挂件
This commit is contained in:
@@ -23,15 +23,20 @@ export default function Live2D() {
|
|||||||
return <canvas id="live2d" className='cursor-pointer' width="280" height="250" onClick={handleClick} alt='切换主题' title='切换主题' />
|
return <canvas id="live2d" className='cursor-pointer' width="280" height="250" onClick={handleClick} alt='切换主题' title='切换主题' />
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载宠物
|
||||||
|
*/
|
||||||
function initLive2D() {
|
function initLive2D() {
|
||||||
// 加载 waifu.css live2d.min.js waifu-tips.js
|
setTimeout(() => {
|
||||||
if (screen.width >= 768) {
|
// 加载 waifu.css live2d.min.js waifu-tips.js
|
||||||
Promise.all([
|
if (screen.width >= 768) {
|
||||||
// loadExternalResource('https://cdn.zhangxinxu.com/sp/demo/live2d/live2d/js/live2d.js', 'js')
|
Promise.all([
|
||||||
loadExternalResource('https://cdn.jsdelivr.net/gh/stevenjoezhang/live2d-widget@latest/live2d.min.js', 'js')
|
// loadExternalResource('https://cdn.zhangxinxu.com/sp/demo/live2d/live2d/js/live2d.js', 'js')
|
||||||
]).then((e) => {
|
loadExternalResource('https://cdn.jsdelivr.net/gh/stevenjoezhang/live2d-widget@latest/live2d.min.js', 'js')
|
||||||
// https://github.com/xiazeyu/live2d-widget-models
|
]).then((e) => {
|
||||||
loadlive2d('live2d', BLOG.WIDGET_PET_LINK)
|
// https://github.com/xiazeyu/live2d-widget-models
|
||||||
})
|
loadlive2d('live2d', BLOG.WIDGET_PET_LINK)
|
||||||
}
|
})
|
||||||
|
}
|
||||||
|
}, 1000)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user