mirror of
https://github.com/ZiuChen/ZiuChen.github.io.git
synced 2025-08-17 23:19:55 +08:00
fix: 修复window not defined导致的构建错误
This commit is contained in:
parent
682afb1eae
commit
ca7817f499
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
node_modules
|
node_modules
|
||||||
dist
|
dist
|
||||||
cache
|
cache
|
||||||
|
.temp
|
@ -1,6 +1,6 @@
|
|||||||
import DefaultTheme from 'vitepress/theme'
|
import DefaultTheme from 'vitepress/theme'
|
||||||
import { onMounted, watch, nextTick, watchEffect } from 'vue'
|
import { onMounted, watch, nextTick, watchEffect } from 'vue'
|
||||||
import { useRouter } from 'vitepress'
|
import { inBrowser, useRouter } from 'vitepress'
|
||||||
import mediumZoom from 'medium-zoom'
|
import mediumZoom from 'medium-zoom'
|
||||||
import Title from '../components/Title.vue'
|
import Title from '../components/Title.vue'
|
||||||
import './index.css'
|
import './index.css'
|
||||||
@ -17,7 +17,7 @@ export default {
|
|||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
// 将router.route.path作为依赖收集 首次访问即添加监听
|
// 将router.route.path作为依赖收集 首次访问即添加监听
|
||||||
const path = router.route.path
|
const path = router.route.path
|
||||||
nextTick(() => mediumZoom('.main img', { background: 'var(--vp-c-bg)' }))
|
nextTick(() => (inBrowser ? mediumZoom('.main img', { background: 'var(--vp-c-bg)' }) : null))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user