fix: 🐛 主题首次切换无效问题修复

Former-commit-id: 1a5028c4e94d8ed28ca567ac2767fdbc8a8516f1
This commit is contained in:
hxr
2023-11-05 17:17:28 +08:00
parent dfbbd5b6f7
commit de90c26210
3 changed files with 20 additions and 14 deletions

View File

@@ -45,7 +45,9 @@ export const useSettingsStore = defineStore("setting", () => {
break;
case "theme":
theme.value = value;
if (theme.value !== "dark") {
if (theme.value === "dark") {
document.documentElement.classList.add("dark");
} else {
document.documentElement.classList.remove("dark");
}
break;