mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-22 22:36:06 +08:00
修复初始化主题加载
This commit is contained in:
parent
8ed071bc29
commit
2b2ddc9b0e
|
@ -28,8 +28,12 @@ export default function (props: any) {
|
|||
useEffect(() => {
|
||||
const colorScheme =
|
||||
window.matchMedia('(prefers-color-scheme: dark)').matches && 'dark';
|
||||
const theme =
|
||||
localStorage.getItem('qinglong_dark_theme') || colorScheme || 'light';
|
||||
console.log(colorScheme);
|
||||
let localTheme = localStorage.getItem('qinglong_dark_theme');
|
||||
if (localTheme === 'auto') {
|
||||
localTheme = null;
|
||||
}
|
||||
const theme = localTheme || colorScheme || 'light';
|
||||
setFetchMethod(window.fetch);
|
||||
if (theme === 'dark') {
|
||||
enableDarkMode({ darkSchemeTextColor: '#fff' });
|
||||
|
@ -45,7 +49,7 @@ export default function (props: any) {
|
|||
<ProLayout
|
||||
selectedKeys={[props.location.pathname]}
|
||||
title="控制面板"
|
||||
menuItemRender={(menuItemProps: any, defaultDom) => {
|
||||
menuItemRender={(menuItemProps: any, defaultDom: any) => {
|
||||
if (
|
||||
menuItemProps.isUrl ||
|
||||
!menuItemProps.path ||
|
||||
|
|
Loading…
Reference in New Issue
Block a user