Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: antd styleProvider typo and runtime #11347

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion docs/docs/max/antd.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,11 @@ export default {

配置 `antd` 的 `StyleProvider` 组件,该组件用于兼容低版本浏览器,如 IE11。当你的项目配置了 `legacy` 或者 `targets` 包含 `ie` 时,会自动进行降级处理,不需要手动配置。

**注意:该配置项仅 antd v5 及以上可用**
**注意:**

1. 该配置项仅 antd v5 及以上可用。

2. 由于降级 CSS 需要依赖 [`@ant-design/cssinjs`](https://ant.design/docs/react/compatible-style-cn) ,若你显示安装了 `antd` ,请安装并确保你的 `@ant-design/cssinjs` 版本与 `antd` 正确对应。

### 运行时配置

Expand Down
4 changes: 4 additions & 0 deletions examples/with-antd-5/.umirc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ export default {
colorPrimary: '#1DA57A',
},
},
styleProvider: {
hashPriority: 'high',
legacyTransformer: true,
},
/**
* [email protected] ~ 5.2.3 仅支持 appConfig: {}, 来启用 <App /> 组件;
* [email protected] 及以上才支持 appConfig: { // ... } 来添加更多 App 配置项;
Expand Down
1 change: 1 addition & 0 deletions packages/plugins/src/antd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ export type IRuntimeConfig = {

api.addRuntimePlugin(() => {
if (
api.config.antd.styleProvider ||
api.config.antd.configProvider ||
(appComponentAvailable && api.config.antd.appConfig)
) {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/templates/antd/runtime.ts.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export function rootContainer(rawContainer) {
container = (
<StyleProvider
{{#styleProvider.hashPriority}}
hashPriority="{{{styleProviderConfig.hashPriority}}}"
hashPriority="{{{styleProvider.hashPriority}}}"
{{/styleProvider.hashPriority}}
{{#styleProvider.legacyTransformer}}
transformers={[legacyLogicalPropertiesTransformer]}
Expand Down