diff --git a/src/components/dark-mask/index.tsx b/src/components/dark-mask/index.tsx index 42a7b169..a14b27f0 100644 --- a/src/components/dark-mask/index.tsx +++ b/src/components/dark-mask/index.tsx @@ -37,6 +37,15 @@ const DarkModeMask = () => { const maskRef = useRef(null); const timerRef = useRef(null); + const initTheme = () => { + const html = document.querySelector('html'); + if (html) { + html.setAttribute('data-theme', savedTheme); + } + }; + + initTheme(); + useEffect(() => { if (savedTheme === 'realDark') { setVisible(true); diff --git a/src/layouts/index.tsx b/src/layouts/index.tsx index 84cb7e8f..868b56b9 100644 --- a/src/layouts/index.tsx +++ b/src/layouts/index.tsx @@ -431,7 +431,7 @@ export default (props: any) => { ...themeData }} > - +