Giter Site home page Giter Site logo

danielyzd / react-admin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sxfad/react-admin

0.0 1.0 0.0 50.73 MB

基于 Ant Design React 的管理系统架构

Home Page: https://sxfad.github.io/react-admin

JavaScript 94.85% HTML 0.94% Less 3.32% Dockerfile 0.21% Shell 0.68%

react-admin's Introduction

React Admin

基于React17.xAnt Design4.x的管理系统架构。

安装依赖

  • node v12.14.0
  • yarn 1.22.10
yarn

注:如果由于网络等原因安装不成功,可以尝试 tyarncnpmnpmyarn --registry https://registry.npm.taobao.org

设置环境变量,windows平台可以使用 cross-env

开发启动

# 正常启动开发模式
yarn start 

# 自定义端口
PORT=3001 yarn start

# HTTPS 方式启动
HTTPS=true yarn start

开发代理

修改src/setupProxy.js

const proxy = require('http-proxy-middleware');

// 前端web服务代理配置
module.exports = function(app) {
    app.use(proxy('/api',
        {
            target: 'http://localhost:8081/', // 目标服务器
            pathRewrite: {
                '^/api': '', // 如果后端接口无前缀,可以通过这种方式去掉
            },
            changeOrigin: true,
            secure: false, // 是否验证证书
            ws: true, // 启用websocket
        },
    ));
};

生产构建

# 正常构建
yarn build

# 构建到指定目录
BUILD_PATH=./dist yarn build

# 指定配置环境
REACT_APP_CONFIG_ENV=test yarn build

# 打包大小分析
yarn build:analyzer

# 打包时间分析
yarn build:time

样式

  • 支持less及css

  • src下less进行css module处理,css不进行css module处理

  • css module 应用样式写法

    import styles from './style.module.less';
    
    <div className={styles.root}>
        <h1 className={styles.title}></h1>
    </div>
  • 复杂的样式处理,推荐使用 classnames

  • 主题变量修改 theme.less antd 样式变量

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.