Skip to content

Commit

Permalink
🐞 fix: 修复评论路径
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiyu1998 committed Aug 17, 2024
1 parent 10ff56a commit 578e31b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .vitepress/theme/components/Comments.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<div class="comments">
<!-- params generate in https://giscus.app/zh-CN -->
<Giscus
v-if="showComment"
repo="zhiyu1998/rconsole-plugin"
repo-id="R_kgDOLNdlcQ"
category="Q&A"
Expand All @@ -19,6 +20,7 @@
</div>
</template>
<script lang="ts" setup>
import { ref, watch, nextTick, computed } from "vue";
import { useData, useRoute } from "vitepress";
import Giscus from "@giscus/vue";
Expand All @@ -27,6 +29,20 @@ const { isDark } = useData();
const theme = computed(() => (isDark.value ? "dark_dimmed" : "light_high_contrast"));
// language变化不会触发重新加载,这里v-if强制刷新
const showComment = ref(true);
watch(
() => route.path,
() => {
showComment.value = false;
nextTick(() => {
showComment.value = true;
});
},
{
immediate: true,
}
);
</script>
<style scoped>
.comments {
Expand Down

0 comments on commit 578e31b

Please sign in to comment.