Skip to content

Commit

Permalink
fix: 修复酷炫代码的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
camera-2018 committed Apr 17, 2023
1 parent 8a59e7a commit abcd42c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
14 changes: 7 additions & 7 deletions .vitepress/theme/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) {
Expand All @@ -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 {
Expand All @@ -54,8 +53,9 @@ function updateHomePageStyle(value) {
else {
if (!homePageStyle)
return

homePageStyle.remove()
homePageStyle = undefined
else {
homePageStyle.remove()
homePageStyle = undefined
}
}
}
4 changes: 0 additions & 4 deletions .vitepress/theme/rainbow.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit abcd42c

Please sign in to comment.