add docs/.vitepress/theme/index.ts
Deploy Guidebook to GitHub Pages / build (push) Canceled after 0s
Deploy Guidebook to GitHub Pages / deploy (push) Canceled after 0s

This commit is contained in:
2026-10-16 16:09:15 +08:00
parent c9b34c96e3
commit 727edd3620
+21
View File
@@ -0,0 +1,21 @@
import DefaultTheme from 'vitepress/theme'
import mediumZoom from 'medium-zoom'
import { onMounted, watch, nextTick } from 'vue'
import { useRoute } from 'vitepress'
import './custom.css'
export default {
extends: DefaultTheme,
setup() {
const route = useRoute()
const initZoom = () => {
// 所有正文图片支持点击放大查看
mediumZoom('.vp-doc img:not(.no-zoom)', {
background: 'rgba(15, 23, 42, 0.82)',
margin: 24
})
}
onMounted(() => nextTick(initZoom))
watch(() => route.path, () => nextTick(initZoom))
}
}