From ca7817f4994d7f268fcba9802db41f895d875003 Mon Sep 17 00:00:00 2001 From: ZiuChen <457353192@qq.com> Date: Tue, 10 Jan 2023 18:15:37 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dwindow=20not=20defined?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E7=9A=84=E6=9E=84=E5=BB=BA=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 ++- docs/.vitepress/theme/index.ts | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) 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)) }) } }