mirror of
https://github.com/ZiuChen/ZiuChen.github.io.git
synced 2025-12-21 02:05:39 +08:00
feat: 定期检查文档更新并弹出提醒
- 扩展基础主题代码做抽取
This commit is contained in:
16
docs/.vitepress/theme/setupMediumZoom.ts
Normal file
16
docs/.vitepress/theme/setupMediumZoom.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
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 }
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user