add docs/.vitepress/theme/index.ts
This commit is contained in:
@@ -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))
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user