Coder Social home page Coder Social logo

yunfan68 / react-antd-admin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from guo-jianqiang/react-antd-admin

0.0 0.0 0.0 25.58 MB

react+ts+antd 实现的管理系统模版

Home Page: https://guo-jianqiang.github.io/react-antd-admin/#/home

License: MIT License

JavaScript 2.12% TypeScript 84.43% HTML 0.66% Less 12.79%

react-antd-admin's Introduction

react-antd-admin

基于react+ts+antd构建的管理后台脚手架模版

install npm packages

npm install
yarn install

run

npm run dev

Project is running at http://localhost:8000/

build

npm run build

约定式路由

export interface RouteItem {
  path: string // 路径
  exact: boolean // 是否精准匹配
  meta: {
    tabFixed?: boolean // 是否固定tab项
    isCache?: boolean // 是否路由缓存
    name: string // 名字
    icon: Function | string // 图标
    hidden?: boolean // 是否隐藏菜单
  }
  component: ComponentType // 渲染组件
  routes?: Array<RouteItem> // 孩子路由
}

可缓存路由

配置只需在routeItems文件中配置参数即可,如下

export interface RouteItem {
  path: string
  exact: boolean
  meta: {
    tabFixed?: boolean // 是否固定tab项
    ...
  }
  component: ComponentType
  routes?: Array<RouteItem>
}

支持清除路由缓存

Tab支持右键contextmenu路由刷新。Layout组件中传入缓存控制函数,更多信息请查看react-router-cache-route

export interface aliveControlInterface {
  dropByCacheKey: (cacheKey: string) => void  // 清除缓存,仅当前页面路由和清除缓存路由不同时可使用
  refreshByCacheKey: (cacheKey: string) => void // 刷新当前路由
  getCachingKeys: () => Array<string> // 或者缓存路由key列表
  clearCache: () => void // 清除所有缓存
}

支持tab拖拽

layout draggableTab 参数可用于控制是否拖拽

环境配置

使用cross-env设置环境变量,从而实现不同环境下的可配置化,配置获取来源为根目录下的env文件夹中获取(development.json、test.json、producation.json)

案例如下:

// development.json 同其他文件
{
  "SERVER_URL": "www.baidu.com"
}
"scripts": {
    "dev": "cross-env NODE_ENV=development webpack serve --config webpack/webpack.dev.ts",
    "test": "cross-env NODE_ENV=test webpack serve --config webpack/webpack.dev.ts",
    "build": "cross-env NODE_ENV=production webpack --config webpack/webpack.prod.ts"
  },
plugins: [
    new webpack.DefinePlugin({
      "process.env.APP_CONFIG": JSON.stringify(envConfig)
    })
    ....
  ]

单独使用Layout

详情请查看rainbow_deer/layout

react-antd-admin's People

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.