feat: stores
This commit is contained in:
@@ -2,11 +2,17 @@ import { ref, computed } from 'vue';
|
|||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import { darkTheme, lightTheme } from 'naive-ui';
|
import { darkTheme, lightTheme } from 'naive-ui';
|
||||||
|
|
||||||
export const useThemeStore = defineStore('ndm-theme-store', () => {
|
export const useThemeStore = defineStore(
|
||||||
|
'ndm-theme-store',
|
||||||
|
() => {
|
||||||
const darkThemeEnabled = ref(true);
|
const darkThemeEnabled = ref(true);
|
||||||
const themeMode = computed(() => {
|
const themeMode = computed(() => {
|
||||||
return darkThemeEnabled.value ? darkTheme : lightTheme;
|
return darkThemeEnabled.value ? darkTheme : lightTheme;
|
||||||
});
|
});
|
||||||
|
|
||||||
return { darkThemeEnabled, themeMode };
|
return { darkThemeEnabled, themeMode };
|
||||||
});
|
},
|
||||||
|
{
|
||||||
|
persist: true,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user