mirror of
https://github.com/ZiuChen/ZiuChen.github.io.git
synced 2025-08-17 23:19:55 +08:00
17 lines
371 B
TypeScript
17 lines
371 B
TypeScript
import { nextTick, watch } from 'vue'
|
|
import { useRoute } from 'vitepress'
|
|
import mediumZoom from 'medium-zoom'
|
|
|
|
export function setupMediumZoom() {
|
|
if (import.meta.env.SSR) return
|
|
|
|
const route = useRoute()
|
|
watch(
|
|
() => route.path,
|
|
() => {
|
|
nextTick(() => mediumZoom('.main img', { background: 'var(--vp-c-bg)' }))
|
|
},
|
|
{ immediate: true }
|
|
)
|
|
}
|