Skip to content

Commit

Permalink
开启主题切换
Browse files Browse the repository at this point in the history
  • Loading branch information
hooray committed Oct 18, 2023
1 parent b7a284d commit d6a6f4f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import eruda from 'eruda'
import VConsole from 'vconsole'
import hotkeys from 'hotkeys-js'
import { dateZhCN, zhCN } from 'naive-ui'
import { darkTheme, dateZhCN, zhCN } from 'naive-ui'
import eventBus from './utils/eventBus'
import useSettingsStore from '@/store/modules/settings'
import useMenuStore from '@/store/modules/menu'
Expand Down Expand Up @@ -70,7 +70,7 @@ import.meta.env.VITE_APP_DEBUG_TOOL === 'vconsole' && new VConsole()
</script>

<template>
<n-config-provider :locale="zhCN" :date-locale="dateZhCN">
<n-config-provider :locale="zhCN" :date-locale="dateZhCN" :theme="settingsStore.settings.app.colorScheme === 'dark' ? darkTheme : undefined" style="height: 100%;">
<n-message-provider>
<router-view
v-slot="{ Component, route }"
Expand All @@ -83,6 +83,7 @@ import.meta.env.VITE_APP_DEBUG_TOOL === 'vconsole' && new VConsole()
<not-allowed v-else />
</router-view>
<system-info />
<n-global-style />
</n-message-provider>
</n-config-provider>
</template>
3 changes: 3 additions & 0 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import type { RecursiveRequired, Settings } from '#/global'
import settingsDefault from '@/settings.default'

const globalSettings: Settings.all = {
toolbar: {
enableColorScheme: true,
},
layout: {
enableMobileAdaptation: true,
},
Expand Down

0 comments on commit d6a6f4f

Please sign in to comment.