Files
HF-MES-manual/.vitepress/theme/index.ts

36 lines
621 B
TypeScript
Raw Normal View History

2026-04-13 12:28:13 +08:00
import DefaultTheme from 'vitepress/theme'
2026-05-11 20:46:02 +08:00
import mediumZoom from 'medium-zoom'
import { onMounted, watch, nextTick } from 'vue'
import { useRoute } from 'vitepress'
2026-04-13 12:28:13 +08:00
import './style/print.css'
2026-05-11 20:46:02 +08:00
import './style/zoom.css'
2026-04-13 12:28:13 +08:00
export default {
...DefaultTheme,
2026-05-11 20:46:02 +08:00
setup() {
const route = useRoute()
const initZoom = () => {
mediumZoom('.main img', {
background: 'rgba(0,0,0,0.8)'
})
}
onMounted(() => {
nextTick(() => {
initZoom()
})
})
watch(
() => route.path,
() => {
nextTick(() => {
initZoom()
})
}
)
}
}