From 527dc45bc089a0deae29fb8eb42648c3e3659cba Mon Sep 17 00:00:00 2001 From: thehrz Date: Sun, 30 Jul 2023 17:31:32 +0800 Subject: [PATCH] pref: update useDarkMode --- src/auto-imports.d.ts | 6 +++--- src/composables/{dark.ts => useDarkMode.ts} | 2 +- src/main.ts | 4 +--- 3 files changed, 5 insertions(+), 7 deletions(-) rename src/composables/{dark.ts => useDarkMode.ts} (89%) diff --git a/src/auto-imports.d.ts b/src/auto-imports.d.ts index e41abf4..64f3156 100644 --- a/src/auto-imports.d.ts +++ b/src/auto-imports.d.ts @@ -146,7 +146,7 @@ declare global { const useCurrentElement: typeof import('@vueuse/core')['useCurrentElement'] const useCycleList: typeof import('@vueuse/core')['useCycleList'] const useDark: typeof import('@vueuse/core')['useDark'] - const useDarkMode: typeof import('./composables/dark')['useDarkMode'] + const useDarkMode: typeof import('./composables/useDarkMode')['default'] const useDateFormat: typeof import('@vueuse/core')['useDateFormat'] const useDebounce: typeof import('@vueuse/core')['useDebounce'] const useDebounceFn: typeof import('@vueuse/core')['useDebounceFn'] @@ -443,7 +443,7 @@ declare module 'vue' { readonly useCurrentElement: UnwrapRef readonly useCycleList: UnwrapRef readonly useDark: UnwrapRef - readonly useDarkMode: UnwrapRef + readonly useDarkMode: UnwrapRef readonly useDateFormat: UnwrapRef readonly useDebounce: UnwrapRef readonly useDebounceFn: UnwrapRef @@ -734,7 +734,7 @@ declare module '@vue/runtime-core' { readonly useCurrentElement: UnwrapRef readonly useCycleList: UnwrapRef readonly useDark: UnwrapRef - readonly useDarkMode: UnwrapRef + readonly useDarkMode: UnwrapRef readonly useDateFormat: UnwrapRef readonly useDebounce: UnwrapRef readonly useDebounceFn: UnwrapRef diff --git a/src/composables/dark.ts b/src/composables/useDarkMode.ts similarity index 89% rename from src/composables/dark.ts rename to src/composables/useDarkMode.ts index 20e797a..9c96b28 100644 --- a/src/composables/dark.ts +++ b/src/composables/useDarkMode.ts @@ -1,6 +1,6 @@ import { useTheme } from 'vuetify' -export function useDarkMode() { +export default () => { const theme = useTheme() const isDark = () => theme.global.current.value.dark diff --git a/src/main.ts b/src/main.ts index c211eaa..52ccdd6 100644 --- a/src/main.ts +++ b/src/main.ts @@ -10,12 +10,10 @@ import '@unocss/reset/tailwind.css' import './styles/main.css' import 'uno.css' -const routes = setupLayouts(generatedRoutes) - // https://github.com/antfu/vite-ssg export const createApp = ViteSSG( App, - { routes, base: import.meta.env.BASE_URL }, + { routes: setupLayouts(generatedRoutes), base: import.meta.env.BASE_URL }, (ctx) => { // install all modules under `modules/` Object.values(import.meta.glob<{ install: UserModule }>('./modules/*.ts', { eager: true }))