mirror of
https://github.com/Art051/it-tools.git
synced 2025-08-11 19:29:03 +00:00
fix(style): working dark mode persistence
This commit is contained in:
@@ -1,13 +1,9 @@
|
|||||||
import { useStorage, usePreferredDark } from '@vueuse/core';
|
import { useStorage } from '@vueuse/core';
|
||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import type { Ref } from 'vue';
|
import type { Ref } from 'vue';
|
||||||
|
|
||||||
export const useStyleStore = defineStore('style', {
|
export const useStyleStore = defineStore('style', {
|
||||||
state: () => {
|
state: () => ({
|
||||||
const isDark = usePreferredDark();
|
isDarkTheme: useStorage('useDarkTheme', false) as Ref<boolean>,
|
||||||
|
}),
|
||||||
return {
|
|
||||||
isDarkTheme: useStorage('useDarkTheme', isDark) as Ref<boolean>,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user