From 605b06a663b4cf736f63bd2cc32075c9bcbfee6b Mon Sep 17 00:00:00 2001 From: xiangshu233 Date: Sun, 10 Mar 2024 21:17:44 +0800 Subject: [PATCH] chore: :rewind: delete updateDarkSign function --- src/theme/index.ts | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 src/theme/index.ts diff --git a/src/theme/index.ts b/src/theme/index.ts deleted file mode 100644 index 61890a7..0000000 --- a/src/theme/index.ts +++ /dev/null @@ -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') - } - } -}