Compare commits
No commits in common. "671504bb33db6ef43f978c2314bf6e3f425c19bf" and "ebf41d74c8830e185f78c2f10c9cf74706b7412c" have entirely different histories.
671504bb33
...
ebf41d74c8
@ -1,14 +0,0 @@
|
|||||||
import { useDark } from '@vueuse/core'
|
|
||||||
|
|
||||||
const darkOptions = {
|
|
||||||
selector: 'html',
|
|
||||||
attribute: 'class',
|
|
||||||
valueDark: 'dark',
|
|
||||||
valueLight: '',
|
|
||||||
storageKey: 'guzhi-color-scheme',
|
|
||||||
initialValue: 'light',
|
|
||||||
}
|
|
||||||
|
|
||||||
export function useAppDark() {
|
|
||||||
return useDark(darkOptions)
|
|
||||||
}
|
|
||||||
@ -1,10 +1,9 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { useAppStore } from '@/store'
|
import { useAppStore } from '@/store'
|
||||||
import { useToggle } from '@vueuse/core'
|
import { useDark, useToggle } from '@vueuse/core'
|
||||||
import { useAppDark } from '@/composables/useAppDark'
|
|
||||||
|
|
||||||
const appStore = useAppStore()
|
const appStore = useAppStore()
|
||||||
const isDark = useAppDark()
|
const isDark = useDark()
|
||||||
const toggleDark = () => {
|
const toggleDark = () => {
|
||||||
appStore.toggleDark()
|
appStore.toggleDark()
|
||||||
useToggle(isDark)()
|
useToggle(isDark)()
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
|
import { useDark } from '@vueuse/core'
|
||||||
import { lStorage } from '@/utils'
|
import { lStorage } from '@/utils'
|
||||||
import i18n from '~/i18n'
|
import i18n from '~/i18n'
|
||||||
import { useAppDark } from '@/composables/useAppDark'
|
|
||||||
|
|
||||||
const currentLocale = lStorage.get('locale')
|
const currentLocale = lStorage.get('locale')
|
||||||
const { locale } = i18n.global
|
const { locale } = i18n.global
|
||||||
|
|
||||||
const isDark = useAppDark()
|
const isDark = useDark()
|
||||||
export const useAppStore = defineStore('app', {
|
export const useAppStore = defineStore('app', {
|
||||||
state() {
|
state() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user