feature: Live2D调整 样式

This commit is contained in:
tangly1024
2021-12-28 15:02:23 +08:00
parent e04890ed71
commit 5b322c2d3d
4 changed files with 8 additions and 7 deletions

View File

@@ -168,9 +168,8 @@ export default function ArticleDetail ({ post, blockMap, recommendPosts, prev, n
</div>
{/* 宠物 */}
<div className='fixed left-0 bottom-0'>
<Live2D/>
</div>
<Live2D/>
</>)
}

View File

@@ -7,7 +7,7 @@ export default function Live2D () {
initLive2D()
}
})
return <div className='animate__fadeIn animate__bounceInUp'>
return <div className='fixed left-0 bottom-0 hidden md:block lg:ml-24 2xl:ml-36'>
<canvas id="live2d" width="280" height="250"></canvas>
</div>
}

View File

@@ -1,10 +1,10 @@
import Head from 'next/head'
import { useEffect } from 'react'
export default function Live2D () {
export default function Live2DWife () {
useEffect(() => {
if (window) {
initLive2D()
initLive2DWife()
}
})
return <>
@@ -12,7 +12,7 @@ export default function Live2D () {
</>
}
function initLive2D () {
function initLive2DWife () {
// 注意live2d_path 参数应使用绝对路径
const live2dPath = 'https://cdn.jsdelivr.net/gh/stevenjoezhang/live2d-widget@latest/'
// const live2d_path = "/live2d-widget/";

View File

@@ -5,6 +5,7 @@ import { getNotionPageData } from '@/lib/notion/getNotionData'
import React, { useEffect } from 'react'
import { useGlobal } from '@/lib/global'
import BlogPostArchive from '@/components/BlogPostArchive'
import Live2D from '@/components/Live2D'
export async function getStaticProps () {
const from = 'index'
@@ -74,6 +75,7 @@ const Index = ({ allPosts, tags, categories }) => {
<BlogPostArchive key={archiveTitle} posts={archivePosts[archiveTitle]} archiveTitle={archiveTitle}/>
))}
</div>
<Live2D/>
</BaseLayout>
)
}