Merge pull request #27 from cshaptx4869/patch-1

fix: 🐛 修复登录页主题切换问题
This commit is contained in:
Ray Hao 2024-02-27 09:58:10 +08:00 committed by GitHub
commit 4a3742b41f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 6 deletions

View File

@ -134,16 +134,15 @@ const userStore = useUserStore();
const settingsStore = useSettingsStore();
import defaultSettings from "@/settings";
import { ThemeEnum } from "@/enums/ThemeEnum";
/**
* 明亮/暗黑主题切换
*/
const isDark = ref<boolean>(settingsStore.theme === "dark");
const isDark = ref<boolean>(settingsStore.theme === ThemeEnum.DARK);
const handleThemeChange = (isDark: any) => {
useToggle(isDark);
settingsStore.changeSetting({
key: "theme",
value: isDark ? "dark" : "light",
});
const theme = isDark ? ThemeEnum.DARK : ThemeEnum.LIGHT;
settingsStore.changeTheme(theme);
document.documentElement.classList.toggle("dark", theme === ThemeEnum.DARK);
};
/**