chore: prepare open source archive
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -1,25 +1,23 @@
|
||||
<script setup lang="ts">
|
||||
import { siteConfig } from '~/config/site'
|
||||
|
||||
const config = useRuntimeConfig()
|
||||
const icp = config.public.icp
|
||||
const psBeian = config.public.psBeian
|
||||
const { filing } = siteConfig
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<footer class="py-6 text-center text-sm border-t" style="color: var(--color-text-secondary); border-color: var(--color-border);">
|
||||
<p>
|
||||
© {{ new Date().getFullYear() }} {{ siteConfig.siteName }}
|
||||
<template v-if="icp">
|
||||
<template v-if="filing.icp">
|
||||
·
|
||||
<a href="https://beian.miit.gov.cn/" target="_blank" rel="noopener noreferrer" class="hover:opacity-70 whitespace-nowrap" style="border-bottom: 1px solid var(--color-text-secondary); padding-bottom: 1px;">{{ icp }}</a>
|
||||
<a href="https://beian.miit.gov.cn/" target="_blank" rel="noopener noreferrer" class="hover:opacity-70 whitespace-nowrap" style="border-bottom: 1px solid var(--color-text-secondary); padding-bottom: 1px;">{{ filing.icp }}</a>
|
||||
</template>
|
||||
<template v-if="psBeian">
|
||||
<template v-if="filing.publicSecurity.code">
|
||||
·
|
||||
<a :href="`https://beian.mps.gov.cn/#/query/webSearch?code=${psBeian}`" rel="noreferrer" target="_blank" class="hover:opacity-70 whitespace-nowrap" style="border-bottom: 1px solid var(--color-text-secondary); padding-bottom: 1px;">
|
||||
<a :href="`https://beian.mps.gov.cn/#/query/webSearch?code=${filing.publicSecurity.code}`" rel="noreferrer" target="_blank" class="hover:opacity-70 whitespace-nowrap" style="border-bottom: 1px solid var(--color-text-secondary); padding-bottom: 1px;">
|
||||
<span class="inline-flex items-center gap-0.5">
|
||||
<img src="@/assets/备案图标.png" alt="" class="w-3 h-3" />
|
||||
<span>川公网安备{{ psBeian }}号</span>
|
||||
<span>{{ filing.publicSecurity.label }}{{ filing.publicSecurity.code }}号</span>
|
||||
</span>
|
||||
</a>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user