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