fix: the issue where the auto theme is invalid due to an incorrect class setting (#5194)

This commit is contained in:
Takagi
2024-05-29 14:26:20 +08:00
committed by GitHub
parent 8fc708be97
commit 409e90d2c5
+3
View File
@@ -32,6 +32,9 @@ export const useTheme = () => {
};
const updateTheme = (theme: string) => {
if (theme === 'auto') {
theme = prefersDark.matches ? 'dark' : 'light';
}
const body = document.documentElement as HTMLElement;
body.setAttribute('class', theme);
};