Skip to content

Commit

Permalink
chore: copy PR umijs#11347
Browse files Browse the repository at this point in the history
  • Loading branch information
fz6m committed Aug 28, 2023
1 parent 702262e commit 4d76a9d
Show file tree
Hide file tree
Showing 6 changed files with 804 additions and 560 deletions.
6 changes: 5 additions & 1 deletion docs/docs/docs/max/antd.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,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,
},
// dark: true,
compact: true,
/**
Expand Down
3 changes: 2 additions & 1 deletion examples/with-antd-5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
"start": "npm run dev"
},
"dependencies": {
"@ant-design/cssinjs": "^1.16.0",
"@umijs/plugins": "workspace:*",
"antd": "^5.3.0",
"antd": "^5.8.4",
"umi": "workspace:*"
}
}
1 change: 1 addition & 0 deletions packages/plugins/src/antd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,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 @@ -103,7 +103,7 @@ export function rootContainer(rawContainer) {
container = (
<StyleProvider
{{#styleProvider.hashPriority}}
hashPriority="{{{styleProviderConfig.hashPriority}}}"
hashPriority="{{{styleProvider.hashPriority}}}"
{{/styleProvider.hashPriority}}
{{#styleProvider.legacyTransformer}}
transformers={[legacyLogicalPropertiesTransformer]}
Expand Down
Loading

0 comments on commit 4d76a9d

Please sign in to comment.