mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-07 09:26:06 +08:00
docs: Update migration docs (#38667)
* Update migration-v5.zh-CN.md * Update migration-v5.zh-CN.md * docs: update doc
This commit is contained in:
parent
4b490834a0
commit
83e8554092
@ -44,6 +44,7 @@ export default {
|
||||
#### Component API adjustment
|
||||
|
||||
- The classname API of the component popup box is unified to `popupClassName`, and `dropdownClassName` and other similar APIs will be replaced.
|
||||
|
||||
- AutoComplete
|
||||
- Cascader
|
||||
- Select
|
||||
@ -66,6 +67,7 @@ export default {
|
||||
```
|
||||
|
||||
- The controlled visible API of the component popup is unified to `open`, and `visible` and other similar APIs will be replaced.
|
||||
|
||||
- Drawer `visible` changed to `open`.
|
||||
- Modal `visible` changed to `open`.
|
||||
- Dropdown `visible` changed to `open`.
|
||||
@ -110,15 +112,11 @@ export default {
|
||||
```
|
||||
|
||||
- `getPopupContainer`: All `getPopupContainer` are guaranteed to return a unique div. This method will be called repeatedly under React 18 concurrent mode.
|
||||
- Dropdown
|
||||
- The style of the wrapper element has been removed, please use the Space component.
|
||||
- `prefixCls` of Dropdown.Button changed to `dropdown`.
|
||||
- Upload List structure changes.
|
||||
- Upload List structure changes. [#34528](https://github.com/ant-design/ant-design/pull/34528)
|
||||
- Notification
|
||||
- Static methods are no longer allowed to dynamically set `prefixCls` `maxCount` `top` `bottom` `getContainer` in `open`, Notification static methods will now have only one instance. If you need a different configuration, use `useNotification`.
|
||||
- `close` was renamed to `destroy` to be consistent with message.
|
||||
- Drawer
|
||||
- `style` & `className` are migrated to Drawer Panel, the original properties are replaced by `rootClassName` and `rootStyle`.
|
||||
- Drawer `style` & `className` are migrated to Drawer panel node, the original properties are replaced by `rootClassName` and `rootStyle`.
|
||||
|
||||
#### Component refactoring and removal
|
||||
|
||||
@ -132,10 +130,10 @@ export default {
|
||||
+ import { Input, Button } from 'antd';
|
||||
|
||||
const App: React.FC = () => (
|
||||
<div>
|
||||
<>
|
||||
<PageHeader />
|
||||
<Comment />
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
|
||||
export default App;
|
||||
@ -171,7 +169,6 @@ If you using antd less variables, you can use compatible package to covert it in
|
||||
import { theme } from 'antd';
|
||||
import { convertLegacyToken } from '@ant-design/compatible';
|
||||
|
||||
|
||||
const { defaultAlgorithm, defaultSeed } = theme;
|
||||
|
||||
const mapToken = defaultAlgorithm(defaultSeed);
|
||||
@ -190,4 +187,4 @@ const v4Token = convertLegacyToken(mapToken);
|
||||
|
||||
## Encounter problems
|
||||
|
||||
If you encounter problems during the upgrade, please go to [GitHub issues](http://new-issue.ant.design/) for feedback. We will respond and improve this document as soon as possible.
|
||||
If you encounter problems during the upgrade, please go to [GitHub issues](https://new-issue.ant.design/) for feedback. We will respond and improve this document as soon as possible.
|
||||
|
@ -45,6 +45,7 @@ export default {
|
||||
#### 组件 API 调整
|
||||
|
||||
- 组件弹框的 classname API 统一为 `popupClassName`,`dropdownClassName` 等类似 API 都会被替换。
|
||||
|
||||
- AutoComplete 组件
|
||||
- Cascader 组件
|
||||
- Select 组件
|
||||
@ -67,6 +68,7 @@ export default {
|
||||
```
|
||||
|
||||
- 组件弹框的受控可见 API 统一为 `open`,`visible` 等类似 API 都会被替换。
|
||||
|
||||
- Drawer 组件 `visible` 变为 `open`。
|
||||
- Modal 组件 `visible` 变为 `open`。
|
||||
- Dropdown 组件 `visible` 变为 `open`。
|
||||
@ -111,15 +113,11 @@ export default {
|
||||
```
|
||||
|
||||
- `getPopupContainer`: 所有的 `getPopupContainer` 都需要保证返回的是唯一的 div。React 18 concurrent 下会反复调用该方法。
|
||||
- Dropdown
|
||||
- 魔改包裹元素样式移除,请使用 Space 组件。
|
||||
- Dropdown.Button 的 `prefixCls` 改为 `dropdown`。
|
||||
- Upload List 结构变化。
|
||||
- Upload List dom 结构变化。[#34528](https://github.com/ant-design/ant-design/pull/34528)
|
||||
- Notification
|
||||
- 静态方法不在允许在 `open` 中动态设置 `prefixCls` `maxCount` `top` `bottom` `getContainer`,Notification 静态方法现在将只有一个实例。如果需要不同配置,请使用 `useNotification`。
|
||||
- `close` 改名为 `destroy` 和 message 保持一致。
|
||||
- Drawer
|
||||
- `style` & `className` 迁移至 Drawer Panel 中,原属性替换为 `rootClassName` 和 `rootStyle`。
|
||||
- `close` 改名为 `destroy`,和 message 保持一致。
|
||||
- Drawer `style` 和 `className` 迁移至 Drawer 弹层区域上,原属性替换为 `rootClassName` 和 `rootStyle`。
|
||||
|
||||
#### 组件重构与移除
|
||||
|
||||
@ -133,10 +131,10 @@ export default {
|
||||
+ import { Input, Button } from 'antd';
|
||||
|
||||
const App: React.FC = () => (
|
||||
<div>
|
||||
<>
|
||||
<PageHeader />
|
||||
<Comment />
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
|
||||
export default App;
|
||||
@ -149,10 +147,10 @@ export default {
|
||||
+ import { FloatButton } from 'antd';
|
||||
|
||||
const App: React.FC = () => (
|
||||
<div>
|
||||
<>
|
||||
- <BackTop />
|
||||
+ <FloatButton.BackTop />
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
|
||||
export default App;
|
||||
@ -172,7 +170,6 @@ npm install --save antd@5.x
|
||||
import { theme } from 'antd';
|
||||
import { convertLegacyToken } from '@ant-design/compatible';
|
||||
|
||||
|
||||
const { defaultAlgorithm, defaultSeed } = theme;
|
||||
|
||||
const mapToken = defaultAlgorithm(defaultSeed);
|
||||
@ -191,4 +188,4 @@ const v4Token = convertLegacyToken(mapToken);
|
||||
|
||||
## 遇到问题
|
||||
|
||||
如果您在升级过程中遇到了问题,请到 [GitHub issues](http://new-issue.ant.design/) 进行反馈。我们会尽快响应和相应改进这篇文档。
|
||||
如果您在升级过程中遇到了问题,请到 [GitHub issues](https://new-issue.ant.design/) 进行反馈。我们会尽快响应和相应改进这篇文档。
|
||||
|
Loading…
Reference in New Issue
Block a user