chore: delete updateDarkSign function

This commit is contained in:
xiangshu233 2024-03-10 21:17:44 +08:00
parent d2c4fd207b
commit 605b06a663

View File

@ -1,25 +0,0 @@
import { addClass, hasClass, removeClass } from '@/utils/domUtils'
/**
* html /
*/
export function updateDarkSign(mode: 'light' | 'dark') {
const htmlRoot = document.getElementById('htmlRoot')
if (!htmlRoot) {
return
}
const hasDarkClass = hasClass(htmlRoot, 'dark')
if (mode === 'dark') {
htmlRoot.setAttribute('data-theme', 'dark')
if (!hasDarkClass) {
addClass(htmlRoot, 'dark')
}
}
else {
htmlRoot.setAttribute('data-theme', 'light')
if (hasDarkClass) {
removeClass(htmlRoot, 'dark')
}
}
}