Skip to content

Commit

Permalink
fix: 尝试修复delta版本样式问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesse205 committed Apr 21, 2024
1 parent eaf3f12 commit 22ed396
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions .vitepress/theme/Layout.vue
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
<script setup>
import DefaultTheme from "vitepress/theme"
import { useRouter } from "vitepress"
import { ref, watchEffect } from "vue"
import DefaultTheme from 'vitepress/theme'
import { useRouter } from 'vitepress'
import { ref, watchEffect } from 'vue'
const { Layout } = DefaultTheme
const router = useRouter()
const isDeltaUrl = ref(false)
watchEffect(() => {
isDeltaUrl.value = router.route.path.includes("/delta/")
isDeltaUrl.value = router.route.path.includes('/delta/')
})
// Delta 主题
if (!import.meta.env.SSR) {
watchEffect(() => {
const classList = document.documentElement.classList
const contains = classList.contains("delta")
if (isDeltaUrl.value && !contains) classList.add("delta")
else if (contains) classList.remove("delta")
const contains = classList.contains('delta')
if (isDeltaUrl.value && !contains) classList.add('delta')
else if (contains) classList.remove('delta')
})
}
</script>
<template>
<Layout> </Layout>
<Layout :class="{ delta: isDeltaUrl }"> </Layout>
</template>
2 changes: 1 addition & 1 deletion .vitepress/theme/custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
--vp-c-text-3: rgba(255, 255, 245, 0.38);
}

:root.delta {
.delta {
/* Theme Colors */
--vp-c-brand-1: var(--c-md-pink-500);
--vp-c-brand-2: var(--c-md-pink-300);
Expand Down

0 comments on commit 22ed396

Please sign in to comment.