perf: update dark mode
This commit is contained in:
parent
0123abc3f0
commit
fc32099b38
14
src/auto-imports.d.ts
vendored
14
src/auto-imports.d.ts
vendored
@ -43,7 +43,6 @@ declare global {
|
|||||||
const h: typeof import('vue')['h']
|
const h: typeof import('vue')['h']
|
||||||
const ignorableWatch: typeof import('@vueuse/core')['ignorableWatch']
|
const ignorableWatch: typeof import('@vueuse/core')['ignorableWatch']
|
||||||
const inject: typeof import('vue')['inject']
|
const inject: typeof import('vue')['inject']
|
||||||
const isDark: typeof import('./composables/dark')['isDark']
|
|
||||||
const isDefined: typeof import('@vueuse/core')['isDefined']
|
const isDefined: typeof import('@vueuse/core')['isDefined']
|
||||||
const isProxy: typeof import('vue')['isProxy']
|
const isProxy: typeof import('vue')['isProxy']
|
||||||
const isReactive: typeof import('vue')['isReactive']
|
const isReactive: typeof import('vue')['isReactive']
|
||||||
@ -72,7 +71,6 @@ declare global {
|
|||||||
const onUnmounted: typeof import('vue')['onUnmounted']
|
const onUnmounted: typeof import('vue')['onUnmounted']
|
||||||
const onUpdated: typeof import('vue')['onUpdated']
|
const onUpdated: typeof import('vue')['onUpdated']
|
||||||
const pausableWatch: typeof import('@vueuse/core')['pausableWatch']
|
const pausableWatch: typeof import('@vueuse/core')['pausableWatch']
|
||||||
const preferredDark: typeof import('./composables/dark')['preferredDark']
|
|
||||||
const provide: typeof import('vue')['provide']
|
const provide: typeof import('vue')['provide']
|
||||||
const reactify: typeof import('@vueuse/core')['reactify']
|
const reactify: typeof import('@vueuse/core')['reactify']
|
||||||
const reactifyObject: typeof import('@vueuse/core')['reactifyObject']
|
const reactifyObject: typeof import('@vueuse/core')['reactifyObject']
|
||||||
@ -88,7 +86,6 @@ declare global {
|
|||||||
const refThrottled: typeof import('@vueuse/core')['refThrottled']
|
const refThrottled: typeof import('@vueuse/core')['refThrottled']
|
||||||
const refWithControl: typeof import('@vueuse/core')['refWithControl']
|
const refWithControl: typeof import('@vueuse/core')['refWithControl']
|
||||||
const resolveComponent: typeof import('vue')['resolveComponent']
|
const resolveComponent: typeof import('vue')['resolveComponent']
|
||||||
const resolveDirective: typeof import('vue')['resolveDirective']
|
|
||||||
const resolveRef: typeof import('@vueuse/core')['resolveRef']
|
const resolveRef: typeof import('@vueuse/core')['resolveRef']
|
||||||
const resolveUnref: typeof import('@vueuse/core')['resolveUnref']
|
const resolveUnref: typeof import('@vueuse/core')['resolveUnref']
|
||||||
const shallowReactive: typeof import('vue')['shallowReactive']
|
const shallowReactive: typeof import('vue')['shallowReactive']
|
||||||
@ -104,8 +101,6 @@ declare global {
|
|||||||
const toRef: typeof import('vue')['toRef']
|
const toRef: typeof import('vue')['toRef']
|
||||||
const toRefs: typeof import('vue')['toRefs']
|
const toRefs: typeof import('vue')['toRefs']
|
||||||
const toValue: typeof import('vue')['toValue']
|
const toValue: typeof import('vue')['toValue']
|
||||||
const toggleDark: typeof import('./composables/dark')['toggleDark']
|
|
||||||
const toggleTheme: typeof import('./composables/dark')['toggleTheme']
|
|
||||||
const triggerRef: typeof import('vue')['triggerRef']
|
const triggerRef: typeof import('vue')['triggerRef']
|
||||||
const tryOnBeforeMount: typeof import('@vueuse/core')['tryOnBeforeMount']
|
const tryOnBeforeMount: typeof import('@vueuse/core')['tryOnBeforeMount']
|
||||||
const tryOnBeforeUnmount: typeof import('@vueuse/core')['tryOnBeforeUnmount']
|
const tryOnBeforeUnmount: typeof import('@vueuse/core')['tryOnBeforeUnmount']
|
||||||
@ -149,7 +144,8 @@ declare global {
|
|||||||
const useCssVars: typeof import('vue')['useCssVars']
|
const useCssVars: typeof import('vue')['useCssVars']
|
||||||
const useCurrentElement: typeof import('@vueuse/core')['useCurrentElement']
|
const useCurrentElement: typeof import('@vueuse/core')['useCurrentElement']
|
||||||
const useCycleList: typeof import('@vueuse/core')['useCycleList']
|
const useCycleList: typeof import('@vueuse/core')['useCycleList']
|
||||||
const useDark: typeof import('./composables/dark')['useDark']
|
const useDark: typeof import('@vueuse/core')['useDark']
|
||||||
|
const useDarkMode: typeof import('./composables/dark')['useDarkMode']
|
||||||
const useDateFormat: typeof import('@vueuse/core')['useDateFormat']
|
const useDateFormat: typeof import('@vueuse/core')['useDateFormat']
|
||||||
const useDebounce: typeof import('@vueuse/core')['useDebounce']
|
const useDebounce: typeof import('@vueuse/core')['useDebounce']
|
||||||
const useDebounceFn: typeof import('@vueuse/core')['useDebounceFn']
|
const useDebounceFn: typeof import('@vueuse/core')['useDebounceFn']
|
||||||
@ -444,7 +440,8 @@ declare module 'vue' {
|
|||||||
readonly useCssVars: UnwrapRef<typeof import('vue')['useCssVars']>
|
readonly useCssVars: UnwrapRef<typeof import('vue')['useCssVars']>
|
||||||
readonly useCurrentElement: UnwrapRef<typeof import('@vueuse/core')['useCurrentElement']>
|
readonly useCurrentElement: UnwrapRef<typeof import('@vueuse/core')['useCurrentElement']>
|
||||||
readonly useCycleList: UnwrapRef<typeof import('@vueuse/core')['useCycleList']>
|
readonly useCycleList: UnwrapRef<typeof import('@vueuse/core')['useCycleList']>
|
||||||
readonly useDark: UnwrapRef<typeof import('./composables/dark')['useDark']>
|
readonly useDark: UnwrapRef<typeof import('@vueuse/core')['useDark']>
|
||||||
|
readonly useDarkMode: UnwrapRef<typeof import('./composables/dark')['useDarkMode']>
|
||||||
readonly useDateFormat: UnwrapRef<typeof import('@vueuse/core')['useDateFormat']>
|
readonly useDateFormat: UnwrapRef<typeof import('@vueuse/core')['useDateFormat']>
|
||||||
readonly useDebounce: UnwrapRef<typeof import('@vueuse/core')['useDebounce']>
|
readonly useDebounce: UnwrapRef<typeof import('@vueuse/core')['useDebounce']>
|
||||||
readonly useDebounceFn: UnwrapRef<typeof import('@vueuse/core')['useDebounceFn']>
|
readonly useDebounceFn: UnwrapRef<typeof import('@vueuse/core')['useDebounceFn']>
|
||||||
@ -733,7 +730,8 @@ declare module '@vue/runtime-core' {
|
|||||||
readonly useCssVars: UnwrapRef<typeof import('vue')['useCssVars']>
|
readonly useCssVars: UnwrapRef<typeof import('vue')['useCssVars']>
|
||||||
readonly useCurrentElement: UnwrapRef<typeof import('@vueuse/core')['useCurrentElement']>
|
readonly useCurrentElement: UnwrapRef<typeof import('@vueuse/core')['useCurrentElement']>
|
||||||
readonly useCycleList: UnwrapRef<typeof import('@vueuse/core')['useCycleList']>
|
readonly useCycleList: UnwrapRef<typeof import('@vueuse/core')['useCycleList']>
|
||||||
readonly useDark: UnwrapRef<typeof import('./composables/dark')['useDark']>
|
readonly useDark: UnwrapRef<typeof import('@vueuse/core')['useDark']>
|
||||||
|
readonly useDarkMode: UnwrapRef<typeof import('./composables/dark')['useDarkMode']>
|
||||||
readonly useDateFormat: UnwrapRef<typeof import('@vueuse/core')['useDateFormat']>
|
readonly useDateFormat: UnwrapRef<typeof import('@vueuse/core')['useDateFormat']>
|
||||||
readonly useDebounce: UnwrapRef<typeof import('@vueuse/core')['useDebounce']>
|
readonly useDebounce: UnwrapRef<typeof import('@vueuse/core')['useDebounce']>
|
||||||
readonly useDebounceFn: UnwrapRef<typeof import('@vueuse/core')['useDebounceFn']>
|
readonly useDebounceFn: UnwrapRef<typeof import('@vueuse/core')['useDebounceFn']>
|
||||||
|
@ -20,7 +20,7 @@ const pages = [
|
|||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
|
|
||||||
const { isDark, toggleDark } = useDark()
|
const { isDark, toggleDark } = useDarkMode()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -42,7 +42,7 @@ const { isDark, toggleDark } = useDark()
|
|||||||
<v-spacer />
|
<v-spacer />
|
||||||
|
|
||||||
<v-btn
|
<v-btn
|
||||||
class="mx-2" :title="t('button.toggle_dark')" :icon="isDark ? 'mdi-weather-night' : 'mdi-weather-sunny'"
|
class="mx-2" :title="t('button.toggle_dark')" :icon="isDark() ? 'mdi-weather-night' : 'mdi-weather-sunny'"
|
||||||
@click="toggleDark()"
|
@click="toggleDark()"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { useTheme } from 'vuetify'
|
import { useTheme } from 'vuetify'
|
||||||
|
|
||||||
export function useDark() {
|
export function useDarkMode() {
|
||||||
const theme = useTheme()
|
const theme = useTheme()
|
||||||
|
|
||||||
const isDark = theme.global.current.value.dark
|
const isDark = () => theme.global.current.value.dark
|
||||||
|
|
||||||
const toggleDark = () => theme.global.name.value = theme.global.current.value.dark
|
const toggleDark = () => theme.global.name.value = theme.global.current.value.dark
|
||||||
? 'light'
|
? 'light'
|
||||||
|
Loading…
Reference in New Issue
Block a user