feat: stores

This commit is contained in:
yangsy
2025-08-17 01:43:59 +08:00
parent 8c8a791409
commit 707ef45a54

View File

@@ -2,11 +2,17 @@ import { ref, computed } from 'vue';
import { defineStore } from 'pinia';
import { darkTheme, lightTheme } from 'naive-ui';
export const useThemeStore = defineStore('ndm-theme-store', () => {
const darkThemeEnabled = ref(true);
const themeMode = computed(() => {
return darkThemeEnabled.value ? darkTheme : lightTheme;
});
export const useThemeStore = defineStore(
'ndm-theme-store',
() => {
const darkThemeEnabled = ref(true);
const themeMode = computed(() => {
return darkThemeEnabled.value ? darkTheme : lightTheme;
});
return { darkThemeEnabled, themeMode };
});
return { darkThemeEnabled, themeMode };
},
{
persist: true,
},
);