feat: update documentation content and rebuild static assets for VitePress project

This commit is contained in:
2026-04-01 15:27:24 +08:00
commit f2cd87c42c
518 changed files with 18646 additions and 0 deletions
+67
View File
@@ -0,0 +1,67 @@
<script setup>
import { onMounted } from 'vue'
const toggleLanguage = () => {
if (typeof OpenCC === 'undefined') {
console.error('OpenCC not loaded')
return
}
const currentMode = localStorage.getItem('lang-mode') || 's2t'
const config = currentMode === 's2t'
? { from: 'cn', to: 'tw' }
: { from: 'tw', to: 'cn' }
const converter = OpenCC.Converter(config)
const root = document.querySelector('#VPContent') || document.body
const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, null, false)
let node
while (node = walker.nextNode()) {
node.textContent = converter(node.textContent)
}
localStorage.setItem('lang-mode', currentMode === 's2t' ? 't2s' : 's2t')
}
onMounted(() => {
// 可以根据本地存储初始化
})
</script>
<template>
<button class="lang-btn" @click="toggleLanguage">
/
</button>
</template>
<style scoped>
.lang-btn {
display: flex;
align-items: center;
padding: 0 12px;
height: 32px;
font-size: 14px;
font-weight: 500;
color: var(--vp-c-text-1);
background: var(--vp-c-bg-soft);
border: 1px solid var(--vp-c-divider);
border-radius: 8px;
cursor: pointer;
transition: all 0.25s;
margin-left: 12px;
}
.lang-btn:hover {
border-color: var(--vp-c-brand-1);
color: var(--vp-c-brand-1);
}
@media (max-width: 768px) {
.lang-btn {
margin: 8px 0;
width: 100%;
justify-content: center;
}
}
</style>
+3
View File
@@ -0,0 +1,3 @@
:root {
--vp-nav-logo-height: 24px;
}
+16
View File
@@ -0,0 +1,16 @@
import { h } from 'vue'
import DefaultTheme from 'vitepress/theme'
import LanguageSwitcher from './LanguageSwitcher.vue'
import './custom.css'
export default {
extends: DefaultTheme,
Layout: () => {
return h(DefaultTheme.Layout, null, {
'nav-bar-content-after': () => h(LanguageSwitcher),
})
},
enhanceApp({ app }) {
app.component('LanguageSwitcher', LanguageSwitcher)
}
}