Files
GuideBook/docs/.vitepress/theme/index.ts
T
dongsk 727edd3620
Deploy Guidebook to GitHub Pages / build (push) Canceled after 0s
Deploy Guidebook to GitHub Pages / deploy (push) Canceled after 0s
add docs/.vitepress/theme/index.ts
2026-10-16 16:09:15 +08:00

22 lines
581 B
TypeScript

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))
}
}