https://github.com/future-team/gfs-react-tools
整合项目中常用工具类库
https://github.com/future-team/gfs-react-tools
Last synced: 7 days ago
JSON representation
整合项目中常用工具类库
- Host: GitHub
- URL: https://github.com/future-team/gfs-react-tools
- Owner: future-team
- License: mit
- Created: 2017-01-05T02:52:18.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-11-20T09:56:19.000Z (over 8 years ago)
- Last Synced: 2025-08-09T06:59:09.360Z (11 months ago)
- Language: JavaScript
- Size: 16.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gfs-react-tools
react工具类整合,相关文档字段使用可参考 [gfs-redux-bind-react](https://github.com/future-team/gfs-redux-bind-react)、[gfs-fetch](https://github.com/future-team/gfs-fetch)、[gfs-loadingbar](https://github.com/future-team/gfs-loadingbar)、[gfs-mock](https://github.com/future-team/gfs-mock);
使用双向绑定功能请安装 [gfs-react-redux-twoway-binding](https://github.com/future-team/gfs-react-redux-twoway-binding)
## 使用
```javascript
import RTools from 'gfs-react-tools'
import Tools from 'gfs-redux-bind-react/lib/Tools'
import React, { Component } from 'react'
class Page extends Component{
constructor(props){
super(props)
this.state = {
desc:'没有请求之前的值'
}
}
componentDidMount(){
//调用RTools中的ajax功能
RTools.fetch('/test').then((data)=>{
this.setState({
desc:data.desc
})
})
}
render(){
return (
{this.state.desc}
)
}
}
//调用
new RTools({
//可选
middleware:[],
//必填
module:Page,
//可选
reducers:[],
//可选
devTools:Tools,
//可选 默认loadingbarComponent
bar:null,
//可选 loadingbar平台(pc/wap/other)other直接使用bar字段作为参数
agent:'pc',
//可选 react component放取的节点id
container:'root'
})
```
## Command
```
#测试
npm run test
#打包
npm run build
#例子演示
npm start
```