vitepress-plugin-comment-with-giscus
Advanced tools
Comparing version 1.0.9 to 1.1.0
{ | ||
"name": "vitepress-plugin-comment-with-giscus", | ||
"version": "1.0.9", | ||
"version": "1.1.0", | ||
"description": "vitepress comment plugin based on giscus", | ||
@@ -5,0 +5,0 @@ "workspaces": [ |
import giscus from '@giscus/vue'; | ||
import { Component, createApp, h, nextTick, onMounted, Ref, watch } from 'vue'; | ||
import { PageData, useRoute } from 'vitepress'; | ||
import { PageData, Route } from 'vitepress'; | ||
import { GiscusProps } from '@giscus/vue/dist/types'; | ||
type vitepressAPI = { | ||
frontmatter: Ref<PageData['frontmatter']>, | ||
route: Route | ||
} | ||
/** | ||
@@ -80,10 +85,14 @@ * 添加评论容器 | ||
const giscusTalk = (frontmatter: Ref<PageData['frontmatter']>, props: GiscusProps) => { | ||
const route = useRoute(); | ||
/** | ||
* 创建评论区 | ||
* @param props giscus配置 | ||
* @param vitepressObj 前言和路由 | ||
*/ | ||
const giscusTalk = (props: GiscusProps, vitepressObj: vitepressAPI) => { | ||
onMounted(() => { | ||
setGiscus(props, frontmatter); | ||
setGiscus(props, vitepressObj.frontmatter); | ||
setThemeWatch(); | ||
}); | ||
watch(() => route.path, () => nextTick(() => { | ||
setGiscus(props, frontmatter); | ||
watch(() => vitepressObj.route.path, () => nextTick(() => { | ||
setGiscus(props, vitepressObj.frontmatter); | ||
})); | ||
@@ -90,0 +99,0 @@ }; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9118
184