使用ant-design:

首先创建react项目:

create-react-app app

cd app

其次

AntDesign的高级配置:按需导入组件,自定义主题

1.下载依赖(利用yarn,或者npm都行)

yarn add react-router-dom    //装路由插件

yarn add antd   //装antd 插件 在 create-react-app 创建的工程中使用 antd 组件

yarn add react-app-rewired customize-cra    //react-app-rewired (一个对 create-react-app 进行自定义配置的社区解决方案)

yarn add babel-plugin-import           //babel-plugin-import 是一个用于按需加载组件代码和样式的 babel 插件

yarn add less less-loader       //按照 配置主题 的要求,自定义主题需要用到 less 变量覆盖功能。

2.修改package.json

"scripts": {

"start": "react-app-rewired start",

"build": "react-app-rewired build",

"test": "react-app-rewired test",

}

- 表示要删除的

+ 表示要添加的

3,在项目根目录创建config-overrides.js

在项目根目录创建一个 config-overrides.js 用于修改默认配置。(js配置文件需要修改)

module.exports = function override(config, env) {

// do stuff with the webpack config...

return config;};

const { override, fixBabelImports, addLessLoader } = require('customize-cra');

module.exports = override(

fixBabelImports('import', {

libraryName: 'antd',

libraryDirectory: 'es',

style: true,

}),

addLessLoader({

javascriptEnabled: true,

modifyVars: { '@primary-color': '#1DA57A' },

}),

);

5-create-react-app整合antDesign功能的更多相关文章

  1. 如何扩展 Create React App 的 Webpack 配置

    如何扩展 Create React App 的 Webpack 配置  原文地址https://zhaozhiming.github.io/blog/2018/01/08/create-react-a ...

  2. 深入 Create React App 核心概念

    本文差点难产而死.因为总结的过程中,多次怀疑本文是对官方文档的直接翻译和简单诺列:同时官方文档很全面,全范围的介绍无疑加深了写作的心智负担.但在最终的梳理中,发现走出了一条与众不同的路,于是坚持分享出 ...

  3. 在 .NET Core 5 中集成 Create React app

    翻译自 Camilo Reyes 2021年2月22日的文章 <Integrate Create React app with .NET Core 5> [1] Camilo Reyes ...

  4. tap news:week5 0.0 create react app

    参考https://blog.csdn.net/qtfying/article/details/78665664 先创建文件夹 安装create react app 这个脚手架(facebook官方提 ...

  5. 使用create react app教程

    This project was bootstrapped with Create React App. Below you will find some information on how to ...

  6. Create React App

    Facebook开源了React前端框架(MIT Licence),也同时提供了React脚手架 - create-react-app. create-react-app遵循约定优于配置(Coc)的原 ...

  7. Create React App 安装less 报错

    执行npm run eject 暴露模块 安装 npm i  less less-loader -D 1.打开 react app 的 webpack.config.js const sassRege ...

  8. [React] Use the Fragment Short Syntax in Create React App 2.0

    create-react-app version 2.0 added a lot of new features. One of the new features is upgrading to Ba ...

  9. [React] {svg, css module, sass} support in Create React App 2.0

    create-react-app version 2.0 added a lot of new features. One of the new features is added the svgr  ...

随机推荐

  1. matplotlib添加坐标轴实现性格测试可视化

    一张图展示最终效果 皮一下很开心,标签名肯定不是用户想要的,所以在这里尝试了定制化功能 功能&方法: 定制化标签名/标签数量(4个/5个).实现方法:在第一个界面点击cancel按钮,进入修改 ...

  2. 多种方式实现平均分栏布局(有间距)div平分行宽

    以下例子基于分四栏+栏间有间距的例子分析 效果图:  html代码: <div class="buy-one-buy"> <h3>淘一淘</h3> ...

  3. Go_io操作

    I/O操作也叫输入输出操作.其中I是指Input,O是指Output,用于读或者写数据的,有些语言中也叫流操作,是指数据通信的通道. Golang 标准库对 IO 的抽象非常精巧,各个组件可以随意组合 ...

  4. 一些 乱码 GPU的问题

    # # s = '网站地图' 原始 # s1 = s.encode('utf-8') # print(s1.decode('gbk')) #res 缃戠珯鍦板浘 # s = '缃戠珯鍦板浘' 原始 # ...

  5. tomcat安装成功以后进行测试步骤:

    tomcat安装成功以后进行测试步骤: 编写测试页面: 进入Tomcat安装对应路径: E:\Tomcat\apache-tomcat-8.5.45\webapps\ROOT 创建:test.jsp ...

  6. Requests库网络爬虫实战

    实例一:页面的爬取 >>> import requests>>> r= requests.get("https://item.jd.com/1000037 ...

  7. Java连载82-Set、Collection、List、Map的UML演示

    一.UML演示Collection集合的继承结构图 二.Set集合 1.List存储元素的特点:有序可重复.有序,存进去是什么顺序,拿出来还是什么顺序. 2.Set存储元素的特点:无序不可重复,存进去 ...

  8. js中的日期控件My97 DatePicker

    使用WdatePicker插件来渲染日期类型的页面. 以下代码用到的属性有: isShowClear是否显示清空按钮 skin皮肤的样式 readOnly是否只读 maxDate:最大的选择时间 &l ...

  9. 1022_Digital_Library (30分)

    这里提供两种写法, 其实都是一样的,第一种比较快. #include <bits/stdc++.h> using namespace std; map<string,set<s ...

  10. The Preliminary Contest for ICPC Asia Shenyang 2019 C Dawn-K's water (完全背包)

    完全背包为什么要取到M,可以取到2*M嘛,这题需要整取,对于不能整取的背包容量,dp[k]=INF,以及dp[j-water[i].weight]=INF时,dp[j]也不需要更新.如果不整取的话,后 ...