Skip to content

Commit

Permalink
fix: naive ui theme
Browse files Browse the repository at this point in the history
  • Loading branch information
bsdayo committed May 4, 2024
1 parent e9004b5 commit fbad895
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions .vitepress/theme/Layout.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<n-config-provider :theme="isDark ? darkTheme : lightTheme">
<n-config-provider :theme="currentTheme">
<Layout>
<template #doc-before v-if="currentPost">
<n-thing class="post-header">
Expand Down Expand Up @@ -35,7 +35,7 @@
</template>

<script lang="ts" setup>
import { computed, nextTick, watch, onMounted } from 'vue'
import { ref, computed, nextTick, watch, onMounted } from 'vue'
import { useData } from 'vitepress'
import DefaultTheme from 'vitepress/theme'
import { data as posts } from '../posts.data'
Expand All @@ -56,6 +56,8 @@ import DateTag from '../../components/DateTag.vue'
const { Layout } = DefaultTheme
const { page, theme, isDark } = useData<ThemeConfig>()
const currentTheme = ref(isDark ? darkTheme : lightTheme)
const taglines: string[] = [
'<code>(() => &lt;bs moe/&gt;)()</code>',
"<code>h('bs', { moe: true })</code>",
Expand Down Expand Up @@ -96,6 +98,14 @@ function addMediumZoom() {
}
onMounted(() => {
watch(
() => isDark.value,
(dark) => {
currentTheme.value = dark ? darkTheme : lightTheme
},
{ immediate: true }
)
import('webfontloader').then((webfont) =>
webfont.load({
google: {
Expand Down

0 comments on commit fbad895

Please sign in to comment.