content
Understand the basic usage of Ant Design of React component library
Antd ant framework
Antd is a React UI component library based on the Ant Design design system, which is mainly used to develop enterprise-level mid- and back-end products.
Which covers PC: Ant Design , mobile: Ant Design Mobile
Basic use
- Import all
installation:
npm install antd-mobile
导入:
import { Button } from 'antd-mobile';
import 'antd-mobile/dist/antd-mobile.css';
- Import on demand
①: install the UI component library: npm install antd-mobile
②: install babel-plugin-import
plug npm install babel-plugin-import
③: be bable
configured (through npm run eject
export profile command)
④: In package.json
configuring the
"babel": {
"presets": [
"react-app"
],
"plugins": [
["import", {
"libraryName": "antd-mobile", "style": "css" }]
]
}
⑤: There is no need to import all styles when using the component, the plug-in will automatically assign it for us
Note: on npm run eject
command being given issue:
Solution: need to git
commit changes command entry, and then re-execute npm run eject
the command
Example:
git add .
git commit -m '提交修改项'