GithubHelp home page GithubHelp logo

zhoubichuan / web-react Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 26.7 MB

📖react 16.x、react17.x相关知识的总结--持续更新💪【http://zhoubichuan.com/web-react】

Home Page: https://zhoubichuan.github.io/web-react/

Shell 5.46% JavaScript 33.03% TypeScript 48.37% HTML 5.70% Less 6.73% CSS 0.71%
react dva dvajs react-redux react-router umi umijs

web-react's Introduction

综合案例

myantd

基本 antd 4.0 二次封装的业务组件库。

文档请配合 antd 文档使用 Ant Design

使用方法

安装

以 yarn 为例

yarn add myantd

配置

.bablerc

使用

1、 使用包内的 ConfigProvider 组件对应用根节点组件进行包裹,修改全局组件命名空间为 myantd

index.js

import React from 'react'
import ReactDOM from 'react-dom'
import App from './App'
import { ConfigProvider } from 'myantd'

ReactDOM.render(
  <ConfigProvider>
    <App />
  </ConfigProvider>,
  document.querySelect('#root')
)

2、这样引入组件即可,会按需加载基于 antd 定制过的组件

import React from 'react'
import { Button } from 'myantd'

export default () => {
  return <Button type="primary">点我</Button>
}

3、此外 myantd 必须全量引入定制过的 antd 样式。

import 'myantd/esm/styles/index.css'

PS:如果项目中已经有 antd 3.x 版本,请引入 myantd 所有组件样式。

import 'myantd/esm/styles/styleWithoutGlobal.css'

譬如在umi项目中使用,定位global入口

import React from 'react'
import { Button,ConfigProvider } from 'myantd';
// + import 'myantd/esm/styles/index.css'

export default function IndexPage() {
  return (
    <ConfigProvider>
      <h1>Page index</h1>
      <Button type="primary">button</Button>
    </ConfigProvider>
  );
}

如何开发 myantd

yarn

# 启动
yarn start

# 构建
yarn build

开发官网

在 src 文件中,修改组件,编写组件文档及单元测试。

发包流程

  1. 提交代码
# 首先确认要提交的文件
git add .

# 运行提交命令
# 无add时,需要优化
yarn commit
# 或者
npm run commit

后续步骤同正常git代码提交流程
  1. 发包
# 升级版本
yarn release
# 或者
npm run release

web-react

这里 阅读体验更佳

整理自各大技术社区和权威书籍的前端技术图谱

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.