pro-components2x 将 @ant-design/pro-xxx 全部修改为 @ant-design/pro-components
Table,Form,List 等组件没有带来新特性,主要是兼容 antd@4 和 css in js 的改造
提供了 @ant-design/pro-components 一个包来管理 procomonents
- ProComponents 2.0 是一个兼容版本,会维护这个版本一段时间。
- 在 antd@5x 占有率达到一定程度时,会发布 3.0 来去除 antd@4 的兼容
https://github.com/ant-design/pro-components/tree/master/packages
yarn add @ant-design/pro-components
import { SmileOutlined } from '@ant-design/icons';
import {
FooterToolbar,
PageContainer,
ProForm,
ProFormDateRangePicker,
ProFormDigit,
ProFormRadio,
ProFormSelect,
ProFormText,
ProFormTextArea,
ProFormUploadButton,
ProLayout,
} from '@ant-design/pro-components';
import '@ant-design/pro-components/dist/components.css';
// 使用 less,可以方便进行主题自定义,也可以做到按需加载
// 等价于安装了以下组件
"dependencies": {
"@ant-design/pro-card": "1.20.21",
"@ant-design/pro-descriptions": "1.12.5",
"@ant-design/pro-field": "1.36.5",
"@ant-design/pro-form": "1.74.5",
"@ant-design/pro-layout": "6.38.22",
"@ant-design/pro-list": "1.21.84",
"@ant-design/pro-provider": "1.10.0",
"@ant-design/pro-skeleton": "1.0.13",
"@ant-design/pro-table": "2.80.5",
"@ant-design/pro-utils": "1.45.3"
},
pro-components源码
安装了 pro-components就不需要安装其他组件了,因为所有组件都聚合在这个 npm包里面
如果用不到这么多组件,就单独安装其中一个,整个包有些大
export * from '@ant-design/pro-card';
export * from '@ant-design/pro-descriptions';
export * from '@ant-design/pro-field';
export * from '@ant-design/pro-form';
export * from '@ant-design/pro-layout';
export * from '@ant-design/pro-list';
export * from '@ant-design/pro-provider';
export * from '@ant-design/pro-skeleton';
export * from '@ant-design/pro-table';
export * from '@ant-design/pro-utils';
export * from './version';
// version源码
export var version = {
"@ant-design/pro-card": "2.0.8",
"@ant-design/pro-components": "2.3.11",
"@ant-design/pro-descriptions": "2.0.9",
"@ant-design/pro-field": "2.1.2",
"@ant-design/pro-form": "2.2.0",
"@ant-design/pro-layout": "7.1.1",
"@ant-design/pro-list": "2.0.9",
"@ant-design/pro-provider": "2.0.3",
"@ant-design/pro-skeleton": "2.0.3",
"@ant-design/pro-table": "3.0.9",
"@ant-design/pro-utils": "2.2.0"
};
version
ProComponents 是其他组件的组合,功能是相同的,同时提供了 version 变量,可以在控制台中输出
import { version } from "@ant-design/pro-components";
console.log(version);
{
"@ant-design/pro-card": "2.0.0-experimental.25",
"@ant-design/pro-components": "2.3.1",
"@ant-design/pro-descriptions": "2.0.0-experimental.26",
"@ant-design/pro-field": "2.0.0-experimental.24",
"@ant-design/pro-form": "2.0.0-experimental.26",
"@ant-design/pro-layout": "7.0.0-experimental.36",
"@ant-design/pro-list": "2.0.0-experimental.27",
"@ant-design/pro-provider": "2.0.0-experimental.14",
"@ant-design/pro-skeleton": "2.0.0-experimental.9",
"@ant-design/pro-table": "3.0.0-experimental.27",
"@ant-design/pro-utils": "2.0.0-experimental.23",
};
proComponents
基于 antd,ts的封装组件