fix: 修复主题无法保存的问题
This commit is contained in:
parent
ed9eacf33f
commit
b09961473e
|
@ -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();
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue