1.最流行的开源 React UI 组件库
(1) material-ui(国外)
(2) ant-design(国内蚂蚁金服)
2.ant-design-mobile使用入门
2.1、使用create-react-app创建react应用
npm install create-react-app -g
create-react-app antm-demo
cd antm-demo
npm start
2.2、搭建antd-mobile的基本开发环境
1)下载
npm install antd-mobile --save
2.3 实现按需打包
1)下载依赖包
npm install react-app-rewired babel-plugin-import --save-dev
2)修改默认配置
- package.json:
"scripts": {
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-app-rewired test --env=jsdom"
}
- config-overrides.js
const {injectBabelPlugin} = require('react-app-rewired');
module.exports = function override(config, env) {
config = injectBabelPlugin(['import', {libraryName: 'antd-mobile', style: 'css'}], config);
return config;
};
网友评论