支持 tailwindcss 深色模式

Signed-off-by: lbw <wangiegie@163.com>
This commit is contained in:
lbw 2024-09-12 03:53:43 +00:00 committed by Gitee
parent 10357f27f7
commit a32c2ae27b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -553,8 +553,14 @@ const onAddFilterChange = (attr: string) => {
// 4 -->
const onAddDarkChange = () => {
const body = document.documentElement as HTMLElement;
if (getThemeConfig.value.isIsDark) body.setAttribute('data-theme', 'dark');
else body.setAttribute('data-theme', '');
if (getThemeConfig.value.isIsDark) {
body.setAttribute('data-theme', 'dark');
// body dark : true class ,tailwindcss
body.classList.add('dark');
} else {
body.classList.remove('dark');
body.setAttribute('data-theme', '');
}
};
// 4 -->
const onWartermarkChange = () => {