调整封装评论插件

This commit is contained in:
tlyong1992
2022-05-27 15:56:04 +08:00
parent cf5786baf0
commit 55c7b018d0
4 changed files with 54 additions and 32 deletions

View File

@@ -0,0 +1,22 @@
import { useGlobal } from '@/lib/global'
import { ReactCusdis } from 'react-cusdis'
import BLOG from '@/blog.config'
import { useRouter } from 'next/router'
const CusdisComponent = ({ frontMatter }) => {
const { locale } = useGlobal()
const router = useRouter()
return <ReactCusdis
lang={locale.LOCALE.toLowerCase()}
attrs={{
host: BLOG.COMMENT_CUSDIS_HOST,
appId: BLOG.COMMENT_CUSDIS_APP_ID,
pageId: frontMatter.id,
pageTitle: frontMatter.title,
pageUrl: BLOG.LINK + router.asPath
}}
/>
}
export default CusdisComponent