@bale-utils/react-utils

1.0.2 • Public • Published

React 前后端统一打包

设置私服

npm config set registry http://192.168.1.115:8081/nexus/content/repositories/react-pack-unify/
npm config set registry http://192.168.1.115:8081/nexus/content/repositories/npm-all/

开发规范

  1. less 统一使用 rem 去编写。

  2. 除 store 使用 class 外, 其余使用组件函数去编写。

  3. 编写 hook 时, 请参照 React Hook 规范。

  4. 所有页面样式以 xxx-page 开头, 以区别页面惟一。

  5. 所有的 store 都需要继承 BaseStore, new 一个 store 时需要使用 type 类型, 统一为 IXxxType, 定义需要导出的属性或方法, 定义属性请使用 interface, 统一为 IXxxProps 如下:

    export type IHomeType = {
      list: Array<any>
      getData: () => void
    }
    
    class HomeStore extends BaseStore {}
    
    const homeStore: IHomeType = new HomeStore()
    export default homeStore
    
  6. 编写组件时, 导出的属性统一用 interface, 命令为 IXxxxProps

  7. 页面里都使用 单引号, 结尾不需要写 ;

  8. 页面中获取属性, 如果需要判断为空, 请不要写 if 判断, 使用 ?, 如: response?.data

  9. 需要打印日志, 请不要使用 console.log, 使用 $log。

  10. 请移除未使用的代码。

  11. 所有的引入都使用 @ 符号, 请查看 tsconfig.path.json, 如在文件中不存在, 请联系添加。

  12. 请不要修改 stores/index.tsx, axios/index.tsx, request/request.tsx, src/index.tsx, layout/router/app.tsx, layout/router/router.interface.tsx 以及 require/config/* 文件。

  13. 请不要修改 eslint, postcss, husky, prettier, typescript 等相关配置文件。

  14. 请不要修改 script 下的 webpack 打包文件。

  15. 路由配置, 请写在 require/router 目录下, 请先在 router.url 中定义 url, 再在 router.tsx 中添加路由。

  16. git 代码提交请使用 ['feat', 'fix', 'update', 'docs', 'style', 'refactor', 'test', 'chore', 'release', 'revert'] 中的其中一个。

  17. ant design mobile 请参考 https://mobile.ant.design/index-cn

  18. 全局字体大小为 .41rem, less 全局变量使用 @font_middle

  19. 统一 toast 调用使用 $http.showToast(), 隐藏使用 $http.hideToast()

  20. 不允许在样式中文件中使用 &- 作为省略简称。

Readme

Keywords

Package Sidebar

Install

npm i @bale-utils/react-utils

Weekly Downloads

4

Version

1.0.2

License

MIT

Unpacked Size

144 kB

Total Files

38

Last publish

Collaborators

  • ztyjr88