@bale-utils/react-utils
v1.0.2
Published
React utils .
Downloads
4
Readme
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/开发规范
less 统一使用
rem去编写。除 store 使用 class 外, 其余使用组件函数去编写。
编写 hook 时, 请参照 React Hook 规范。
所有页面样式以
xxx-page开头, 以区别页面惟一。所有的 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编写组件时, 导出的属性统一用 interface, 命令为
IXxxxProps页面里都使用
单引号, 结尾不需要写;页面中获取属性, 如果需要判断为空, 请不要写 if 判断, 使用
?, 如:response?.data。需要打印日志, 请不要使用 console.log, 使用 $log。
请移除未使用的代码。
所有的引入都使用
@符号, 请查看tsconfig.path.json, 如在文件中不存在, 请联系添加。请不要修改
stores/index.tsx,axios/index.tsx,request/request.tsx,src/index.tsx,layout/router/app.tsx,layout/router/router.interface.tsx以及require/config/*文件。请不要修改
eslint,postcss,husky,prettier,typescript等相关配置文件。请不要修改
script下的 webpack 打包文件。路由配置, 请写在
require/router目录下, 请先在router.url中定义 url, 再在router.tsx中添加路由。git 代码提交请使用 [
'feat', 'fix', 'update', 'docs', 'style', 'refactor', 'test', 'chore', 'release', 'revert'] 中的其中一个。ant design mobile请参考https://mobile.ant.design/index-cn。全局字体大小为
.41rem, less 全局变量使用@font_middle。统一 toast 调用使用
$http.showToast(), 隐藏使用$http.hideToast()。不允许在样式中文件中使用
&-作为省略简称。
