mirror of
https://github.com/xiangshu233/vue3-vant4-mobile.git
synced 2025-04-06 03:57:47 +08:00
chore: ⏪ delete updateDarkSign function
This commit is contained in:
parent
d2c4fd207b
commit
605b06a663
@ -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')
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user