react 第七章——react-ui

2019-07-28  本文已影响0人  定格r

1.最流行的开源 React UI 组件库

(1) material-ui(国外)

  1. 官网: http://www.material-ui.com/#/

  2. github: https://github.com/callemall/material-ui

(2) ant-design(国内蚂蚁金服)

  1. PC官网: https://ant.design/index-cn

  2. 移动官网: https://mobile.ant.design/index-cn

  3. Github: https://github.com/ant-design/ant-design/

  4. Github: https://github.com/ant-design/ant-design-mobile/

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)修改默认配置

"scripts": {
  "start": "react-app-rewired start",
  "build": "react-app-rewired build",
  "test": "react-app-rewired test --env=jsdom"
}
const {injectBabelPlugin} = require('react-app-rewired');
module.exports = function override(config, env) {
  config = injectBabelPlugin(['import', {libraryName: 'antd-mobile', style: 'css'}], config);
  return config;
};
上一篇下一篇

猜你喜欢

热点阅读