在umi4中使用antd5的主题预设算法,可以在运行时配置configProvider.theme吗 #12702
Replies: 1 comment
-
algorithm 只允许在运行时配置的。文档里面有说明,原因是配置往下传到生成模版文件的时候,是一个字符串 The 'algorithm' option only available for runtime config, please move it to the runtime plugin, see: https://umijs.org/docs/max/antd#运行时配置 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
在config.ts直接配置 dark: true,可以全局生效;
antd: {
dark: true,
},
在config.ts开启configProvider,然后在layout里面配置 ,貌似只有部分组件生效了,没有全局生效
configProvider: {
theme: {
algorithm: theme.darkAlgorithm,
},
},
在app.tsx里面导出antd配置 可以全局生效
export const antd: any = (memo) => {
memo.theme.algorithm = theme.darkAlgorithm; // 配置 antd5 的预设 dark 算法
return memo;
};
按理说使用configProvider方法的配置也能生效才对?
Beta Was this translation helpful? Give feedback.
All reactions