更新 .vitepress/theme/index.ts

This commit is contained in:
2026-05-11 20:45:26 +08:00
parent 7c0c9e46dd
commit 6a853d360b

View File

@@ -1,6 +1,36 @@
import DefaultTheme from 'vitepress/theme'
import mediumZoom from 'medium-zoom'
import { onMounted, watch, nextTick } from 'vue'
import { useRoute } from 'vitepress'
import './style/print.css'
import './style/zoom.css'
export default {
...DefaultTheme,
setup() {
const route = useRoute()
const initZoom = () => {
mediumZoom('.main img', {
background: 'rgba(0,0,0,0.8)'
})
}
onMounted(() => {
nextTick(() => {
initZoom()
})
})
watch(
() => route.path,
() => {
nextTick(() => {
initZoom()
})
}
)
}
}