docs: @ant-design/pro-layout => @ant-design/pro-components (#49249)

Co-authored-by: vagusX <vagusxl@gmail.com>
This commit is contained in:
afc163 2024-06-05 21:01:15 +08:00 committed by GitHub
parent 3673430978
commit 16e03956c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 15 additions and 13 deletions

View File

@ -132,7 +132,7 @@ This document will help you upgrade from antd `4.x` version to antd `5.x` versio
```diff ```diff
- import { PageHeader, Comment } from 'antd'; - import { PageHeader, Comment } from 'antd';
+ import { Comment } from '@ant-design/compatible'; + import { Comment } from '@ant-design/compatible';
+ import { PageHeader } from '@ant-design/pro-layout'; + import { PageHeader } from '@ant-design/pro-components';
const App: React.FC = () => ( const App: React.FC = () => (
<> <>
@ -168,11 +168,11 @@ Use git to save your code and install latest version:
npm install --save antd@5.x npm install --save antd@5.x
``` ```
If you want to use v4 deprecated component like `Comment` or `PageHeader`. You can install `@ant-design/compatible` and `@ant-design/pro-layout` for compatible: If you want to use v4 deprecated component like `Comment` or `PageHeader`. You can install `@ant-design/compatible` and `@ant-design/pro-components` for compatible:
```bash ```bash
npm install --save @ant-design/compatible@v5-compatible-v4 npm install --save @ant-design/compatible@v5-compatible-v4
npm install --save @ant-design/pro-layout npm install --save @ant-design/pro-components
``` ```
You can manually check the code one by one against the above list for modification. In addition, we also provide a codemod cli tool [@ant-design/codemod-v5](https://github.com/ant-design/codemod-v5) To help you quickly upgrade to v5. You can manually check the code one by one against the above list for modification. In addition, we also provide a codemod cli tool [@ant-design/codemod-v5](https://github.com/ant-design/codemod-v5) To help you quickly upgrade to v5.

View File

@ -125,7 +125,9 @@ tag: Updated
```diff ```diff
- import { PageHeader, Comment } from 'antd'; - import { PageHeader, Comment } from 'antd';
+ import { Comment } from '@ant-design/compatible'; + import { Comment } from '@ant-design/compatible';
+ import { PageHeader } from '@ant-design/pro-layout'; + import { PageHeader } from '@ant-design/pro-components';
// 如果是蚂蚁内网用户建议从 @alipay/tech-ui 引入
// import { PageHeader } from '@alipay/tech-ui';
const App: React.FC = () => ( const App: React.FC = () => (
<> <>
@ -161,11 +163,11 @@ tag: Updated
npm install --save antd@5.x npm install --save antd@5.x
``` ```
如果你需要使用 v4 废弃组件如 `Comment`、`PageHeader`,请安装 `@ant-design/compatible``@ant-design/pro-layout` 做兼容: 如果你需要使用 v4 废弃组件如 `Comment`、`PageHeader`,请安装 `@ant-design/compatible``@ant-design/pro-components` 做兼容:
```bash ```bash
npm install --save @ant-design/compatible@v5-compatible-v4 npm install --save @ant-design/compatible@v5-compatible-v4
npm install --save @ant-design/pro-layout npm install --save @ant-design/pro-components
``` ```
你可以手动对照上面的列表逐条检查代码进行修改,另外,我们也提供了一个 codemod cli 工具 [@ant-design/codemod-v5](https://github.com/ant-design/codemod-v5) 以帮助你快速升级到 v5 版本。 你可以手动对照上面的列表逐条检查代码进行修改,另外,我们也提供了一个 codemod cli 工具 [@ant-design/codemod-v5](https://github.com/ant-design/codemod-v5) 以帮助你快速升级到 v5 版本。

View File

@ -56,10 +56,10 @@ Before starting the project, let's install some more dependencies that will be u
```bash ```bash
$ pnpm i @umijs/plugins -D $ pnpm i @umijs/plugins -D
$ pnpm i antd axios @ant-design/pro-layout -S $ pnpm i antd axios @ant-design/pro-components -S
``` ```
`@umijs/plugins` is the official plugin set of Umi, containing a large number of plugins such as valtio, react-query, styled-components, locale, access, qiankun, etc. `antd` needs no introduction. `axios` is the request library; `@ant-design/pro-layout` is the component used to generate the layouts. `@umijs/plugins` is the official plugin set of Umi, containing a large number of plugins such as valtio, react-query, styled-components, locale, access, qiankun, etc. `antd` needs no introduction. `axios` is the request library; `@ant-design/pro-components` is the component used to generate the layouts.
When finished, execute the following command to start the project. When finished, execute the following command to start the project.
@ -297,7 +297,7 @@ export default defineConfig({
Edit `src/layouts/index.tsx` with the following code. Edit `src/layouts/index.tsx` with the following code.
```tsx ```tsx
import { ProLayout } from '@ant-design/pro-layout'; import { ProLayout } from '@ant-design/pro-components';
import { Link, Outlet, useAppData, useLocation } from 'umi'; import { Link, Outlet, useAppData, useLocation } from 'umi';
export default function Layout() { export default function Layout() {

View File

@ -56,10 +56,10 @@ $ pnpm create umi
```bash ```bash
$ pnpm i @umijs/plugins -D $ pnpm i @umijs/plugins -D
$ pnpm i antd axios @ant-design/pro-layout -S $ pnpm i antd axios @ant-design/pro-components -S
``` ```
其中 `@umijs/plugins` 是 Umi 的官方插件集,包含了 valtio、react-query、styled-components、locale、access、qiankun 等大量插件,可让用户通过配置的方式一键开启和使用;`antd` 就不用介绍了;`axios` 是请求库;`@ant-design/pro-layout` 是用于生成中后台布局的组件。(这里将运行时依赖和编译时依赖分别保存到 dependencies 和 devDependencies是目前社区推荐的方式 其中 `@umijs/plugins` 是 Umi 的官方插件集,包含了 valtio、react-query、styled-components、locale、access、qiankun 等大量插件,可让用户通过配置的方式一键开启和使用;`antd` 就不用介绍了;`axios` 是请求库;`@ant-design/pro-components` 是用于生成中后台布局的组件。(这里将运行时依赖和编译时依赖分别保存到 dependencies 和 devDependencies是目前社区推荐的方式
完成后,执行以下命令启动项目。 完成后,执行以下命令启动项目。
@ -101,7 +101,7 @@ export default defineConfig({
routes: [ routes: [
{ path: "/", component: "index" }, { path: "/", component: "index" },
{ path: "/docs", component: "docs" }, { path: "/docs", component: "docs" },
+ { path: "/products", component: "products" }, + { path: "/products", component: "products" },
], ],
npmClient: "pnpm", npmClient: "pnpm",
}); });
@ -297,7 +297,7 @@ export default defineConfig({
编辑 `src/layouts/index.tsx`,内容如下。 编辑 `src/layouts/index.tsx`,内容如下。
```tsx ```tsx
import { ProLayout } from '@ant-design/pro-layout'; import { ProLayout } from '@ant-design/pro-components';
import { Link, Outlet, useAppData, useLocation } from 'umi'; import { Link, Outlet, useAppData, useLocation } from 'umi';
export default function Layout() { export default function Layout() {