chore: prepare open source archive

This commit is contained in:
2026-07-19 18:49:14 +08:00
parent 9756bbaa5a
commit 18b74a9d51
16 changed files with 94 additions and 1943 deletions
+12 -2
View File
@@ -3,6 +3,14 @@ import { siteConfig } from '~/config/site'
const colorMode = useColorMode()
const container = ref<HTMLElement>()
const isEnabled = computed(() =>
Boolean(
siteConfig.giscus.repo
&& siteConfig.giscus.repoId
&& siteConfig.giscus.category
&& siteConfig.giscus.categoryId
)
)
function loadGiscus() {
if (!container.value) return
@@ -29,10 +37,12 @@ function loadGiscus() {
}
onMounted(() => {
loadGiscus()
if (isEnabled.value) loadGiscus()
})
watch(() => colorMode.value, () => {
if (!isEnabled.value) return
const frame = document.querySelector<HTMLIFrameElement>('iframe.giscus-frame')
if (frame?.contentWindow) {
frame.contentWindow.postMessage(
@@ -44,7 +54,7 @@ watch(() => colorMode.value, () => {
</script>
<template>
<div>
<div v-if="isEnabled">
<h2 class="text-xl font-semibold mb-4">评论</h2>
<div ref="container" />
</div>