From abcd42cca8a424140e2d7a0a0af61227745df220 Mon Sep 17 00:00:00 2001 From: camera-2018 <2907618001@qq.com> Date: Mon, 17 Apr 2023 19:38:53 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=85=B7=E7=82=AB?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vitepress/theme/index.js | 14 +++++++------- .vitepress/theme/rainbow.css | 4 ---- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/.vitepress/theme/index.js b/.vitepress/theme/index.js index 5eaaf29..e21eee0 100644 --- a/.vitepress/theme/index.js +++ b/.vitepress/theme/index.js @@ -5,14 +5,13 @@ import DefaultTheme from 'vitepress/theme-without-fonts' import './style.css' import './rainbow.css' -let homePageStyle +let homePageStyle = undefined export default { ...DefaultTheme, Layout: () => { return h(DefaultTheme.Layout, null, { - }) }, enhanceApp({ app, router, siteData }) { @@ -38,12 +37,12 @@ if (typeof window !== 'undefined') { document.documentElement.classList.add('browser-safari') } -// Speed up the rainbow animation on home page function updateHomePageStyle(value) { + console.log(homePageStyle) + console.log(value) if (value) { if (homePageStyle) return - homePageStyle = document.createElement('style') homePageStyle.innerHTML = ` :root { @@ -54,8 +53,9 @@ function updateHomePageStyle(value) { else { if (!homePageStyle) return - - homePageStyle.remove() - homePageStyle = undefined + else { + homePageStyle.remove() + homePageStyle = undefined + } } } \ No newline at end of file diff --git a/.vitepress/theme/rainbow.css b/.vitepress/theme/rainbow.css index 8e5968a..b3a5d54 100644 --- a/.vitepress/theme/rainbow.css +++ b/.vitepress/theme/rainbow.css @@ -82,10 +82,6 @@ 100% { --vp-c-brand: #00a98e; --vp-c-brand-light: #4ad1b4; --vp-c-brand-lighter: #78fadc; --vp-c-brand-dark: #008269; --vp-c-brand-darker: #005d47; --vp-c-brand-next: #009ff7; } } -:root { - --vp-c-brand: #00a98e; --vp-c-brand-light: #4ad1b4; --vp-c-brand-lighter: #78fadc; --vp-c-brand-dark: #008269; --vp-c-brand-darker: #005d47; --vp-c-brand-next: #009ff7; - animation: rainbow 40s linear infinite; -} @media (prefers-reduced-motion: reduce) { :root {