@gdjiami/rc-components
mygzb.com React Components
Last updated a month ago by carney520 .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install @gdjiami/rc-components 
SYNC missed versions from official npm registry.

React Components

React 组件库, 收集了工作宝中后台应用的常用组件或套件. 致力于减少应用开发的代码重复,提高维护效率

DEMO

Installation

yarn add @gdjiami/rc-components

# 依赖
yarn add react react-dom tslib react-router react-router-dom

Usage

所有组件都在es目录下, es 使用 ES6 模块系统,另外每目录下面都有 Typescript 声明文件,所以支持类型检查,开发者可以按需导入需要的组件

rc-components 支持类似于antd的按需加载方式,如果你使用 typescript 可以使用ts-import-plugin 插件, 例如:

// webpack.config.js
const tsImportPluginFactory = require('ts-import-plugin')

module.exports = {
  // ...
  module: {
    rules: [
      {
        test: /\.(jsx|tsx|js|ts)$/,
        loader: 'ts-loader',
        options: {
          transpileOnly: true,
          getCustomTransformers: () => ({
            before: [
              tsImportPluginFactory([
                // 按需导入antd组件
                {
                  libraryName: 'antd',
                  libraryDirectory: 'es',
                  style: 'css',
                },
                // 按需导入rc-components组件
                {
                  libraryName: '@gdjiami/rc-components',
                  libraryDirectory: 'es',
                  style: 'css',
                },
              ]),
            ],
          }),
        },
        exclude: /node_modules/,
      },
    ],
  },
  // ...
}

对于babel可以使用babel-plugin-import 插件

使用示例

import React from 'react'
import { Login } from '@gdjiami/rc-components'
import { message } from 'antd'
import { delay } from './utils'

export default class LoginPage extends React.Component {
  public render() {
    return (
      <Login
        title="登录页面"
        onSubmit={this.handleSubmit}
        onSuccess={this.handleSuccess}
      />
    )
  }

  private handleSubmit = async () => {
    await delay(2000)
  }

  private handleSuccess = () => {
    message.success('登录成功')
  }
}

定位

rc-components 是基于 antd 组件库之上的高层组件库,旨在抽象重复的业务场景, 减少代码重复。其中耦合的东西有:

  • antd
  • react, react-dom
  • tslib
  • react-router v4
  • lodash

这些耦合的技术是 rc-components 的构建基础,而且在团队内的应用是比较稳定的、静态的,近期不会有大的变动。相对的,有些东西是我们 要避免耦合的:

  • 状态管理库,如 mobx,redux.
  • Ajax 请求库
  • 前端路由类型

License

This project is licensed under the terms of the MIT license.

Current Tags

  • 0.2.19                                ...           latest (a month ago)

72 Versions

  • 0.2.19                                ...           a month ago
  • 0.2.18                                ...           a month ago
  • 0.2.17                                ...           a month ago
  • 0.2.16                                ...           2 months ago
  • 0.2.15                                ...           2 months ago
  • 0.2.14                                ...           2 months ago
  • 0.2.13                                ...           3 months ago
  • 0.2.12                                ...           6 months ago
  • 0.2.11                                ...           7 months ago
  • 0.2.10                                ...           7 months ago
  • 0.2.9                                ...           7 months ago
  • 0.2.8                                ...           7 months ago
  • 0.2.7                                ...           8 months ago
  • 0.2.6                                ...           8 months ago
  • 0.2.5                                ...           8 months ago
  • 0.2.4                                ...           8 months ago
  • 0.2.3                                ...           9 months ago
  • 0.2.2                                ...           9 months ago
  • 0.2.1                                ...           9 months ago
  • 0.2.0                                ...           9 months ago
  • 0.1.54                                ...           9 months ago
  • 0.1.53                                ...           9 months ago
  • 0.1.52                                ...           9 months ago
  • 0.1.51                                ...           9 months ago
  • 0.1.50                                ...           9 months ago
  • 0.1.48                                ...           9 months ago
  • 0.1.47                                ...           9 months ago
  • 0.1.46                                ...           9 months ago
  • 0.1.45                                ...           9 months ago
  • 0.1.44                                ...           9 months ago
  • 0.1.43                                ...           9 months ago
  • 0.1.42                                ...           9 months ago
  • 0.1.41                                ...           9 months ago
  • 0.1.40                                ...           9 months ago
  • 0.1.39                                ...           9 months ago
  • 0.1.38                                ...           9 months ago
  • 0.1.37                                ...           9 months ago
  • 0.1.36                                ...           9 months ago
  • 0.1.35                                ...           9 months ago
  • 0.1.34                                ...           9 months ago
  • 0.1.33                                ...           9 months ago
  • 0.1.32                                ...           9 months ago
  • 0.1.31                                ...           9 months ago
  • 0.1.30                                ...           9 months ago
  • 0.1.29                                ...           10 months ago
  • 0.1.28                                ...           10 months ago
  • 0.1.27                                ...           10 months ago
  • 0.1.26                                ...           10 months ago
  • 0.1.25                                ...           10 months ago
  • 0.1.24                                ...           10 months ago
  • 0.1.22                                ...           a year ago
  • 0.1.21                                ...           a year ago
  • 0.1.20                                ...           a year ago
  • 0.1.19                                ...           a year ago
  • 0.1.17                                ...           a year ago
  • 0.1.16                                ...           a year ago
  • 0.1.15                                ...           a year ago
  • 0.1.14                                ...           a year ago
  • 0.1.13                                ...           a year ago
  • 0.1.12                                ...           a year ago
  • 0.1.11                                ...           a year ago
  • 0.1.10                                ...           a year ago
  • 0.1.9                                ...           a year ago
  • 0.1.8                                ...           a year ago
  • 0.1.7                                ...           a year ago
  • 0.1.6                                ...           a year ago
  • 0.1.5                                ...           a year ago
  • 0.1.4                                ...           a year ago
  • 0.1.3                                ...           a year ago
  • 0.1.2                                ...           a year ago
  • 0.1.1                                ...           a year ago
  • 0.1.0                                ...           a year ago
Maintainers (2)
Downloads
Today 0
This Week 0
This Month 74
Last Day 0
Last Week 2
Last Month 103
Dependencies (5)
Dev Dependencies (30)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |