diff --git a/.gitignore b/.gitignore index 7f548e85..523a1a98 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules dist -cache \ No newline at end of file +cache +.temp \ No newline at end of file diff --git a/docs/.vitepress/theme/index.ts b/docs/.vitepress/theme/index.ts index 3676a375..d8dd5e10 100644 --- a/docs/.vitepress/theme/index.ts +++ b/docs/.vitepress/theme/index.ts @@ -1,6 +1,6 @@ import DefaultTheme from 'vitepress/theme' import { onMounted, watch, nextTick, watchEffect } from 'vue' -import { useRouter } from 'vitepress' +import { inBrowser, useRouter } from 'vitepress' import mediumZoom from 'medium-zoom' import Title from '../components/Title.vue' import './index.css' @@ -17,7 +17,7 @@ export default { watchEffect(() => { // 将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)) }) } }