fix: 修复主题无法保存的问题

This commit is contained in:
SikongJueluo 2025-08-11 16:21:25 +08:00
parent ed9eacf33f
commit b09961473e
No known key found for this signature in database
1 changed files with 4 additions and 3 deletions

View File

@ -4,13 +4,13 @@ import Dialog from "./components/Dialog.vue";
import { Alert, useAlertProvider } from "./components/Alert";
import { ref, provide, computed, onMounted } from "vue";
import { useRouter } from "vue-router";
import { useThemeStore } from "./stores/theme";
const router = useRouter();
const theme = useThemeStore();
//
const isDarkMode = ref(
window.matchMedia("(prefers-color-scheme: dark)").matches,
);
const isDarkMode = ref(theme.isDarkTheme());
// Navbar
const showNavbar = ref(true);
@ -46,6 +46,7 @@ const applyTheme = () => {
//
const toggleTheme = () => {
isDarkMode.value = !isDarkMode.value;
theme.toggleTheme();
applyTheme();
};