From 1cc54b5da6d5c34cf278e6d919d44d9d3170a402 Mon Sep 17 00:00:00 2001 From: hanhh <18330117883@163.com> Date: Sun, 19 Sep 2021 21:27:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=85=A8=E5=B1=80=E4=B8=BB?= =?UTF-8?q?=E9=A2=98className?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layouts/index.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/layouts/index.tsx b/src/layouts/index.tsx index 8a4ec698..2e1f4c88 100644 --- a/src/layouts/index.tsx +++ b/src/layouts/index.tsx @@ -64,6 +64,16 @@ export default function (props: any) { } }, [props.location.pathname]); + useEffect(() => { + if (theme && theme.theme) { + if (theme.theme === 'vs-dark') { + document.body.classList.add('dark'); + } else { + document.body.classList.add('white'); + } + } + }, [theme]); + useEffect(() => { const _theme = localStorage.getItem('qinglong_dark_theme') || 'auto'; setFetchMethod(window.fetch); @@ -92,7 +102,6 @@ export default function (props: any) { 控制面板