🐛: 切换主题 Embedded Dark Reader cannot access a cross-origin resource

This commit is contained in:
sight 2022-06-28 14:57:17 +08:00
parent 4047d0dbba
commit 46d5533e45

View File

@ -13,6 +13,7 @@ import {
enable as enableDarkMode,
disable as disableDarkMode,
auto as followSystemColorScheme,
setFetchMethod
} from "@umijs/ssr-darkreader";
export interface LayConfigProviderProps {
@ -71,6 +72,9 @@ const changeTheme = (theme: string) => {
};
Object.assign(defaultPartial, props.darkPartial);
if (theme === "dark") {
if(window){
setFetchMethod(window.fetch);
}
enableDarkMode(defaultPartial, defaultFixes);
} else if (theme === "light") {
disableDarkMode();