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