Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hjzheng/react-hehe-utils
just a react utils (持续更新中)
https://github.com/hjzheng/react-hehe-utils
Last synced: 27 days ago
JSON representation
just a react utils (持续更新中)
- Host: GitHub
- URL: https://github.com/hjzheng/react-hehe-utils
- Owner: hjzheng
- License: mit
- Created: 2017-08-12T04:27:31.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-08-14T06:13:56.000Z (about 7 years ago)
- Last Synced: 2024-10-06T17:35:35.377Z (about 1 month ago)
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/react-hehe-utils
- Size: 11.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# react-hehe-utils
### Resource
```js
import { Resource } from 'react-hehe-utils';const res = new Resource('/web-api/1.0/users/:id', {
list: {
url: '/web-api/1.0/users/list',
method: 'get',
params: {
pageSize: 10,
pageNum: 1
}
}
});res.get({id: 9527}).then(result => {
console.log(result);
}).catch(err => {
console.log(err);
});res.list().then(result => {
console.log(result);
}).catch(err => {
console.log(err);
})/*
* 自动生成
* get(params, config); // method: get
* save(params, data, config); // method: post
* remove(params, config); // method: delete
* delete(params, config); // method: delete
* update(params, data, config); // method: put
*
* 注意 config 参数的配置
* https://github.com/mzabriskie/axios#request-config
*
* config 中的三个参数:
* url 没有任何作用
* data 会 merge 到 data 参数中
* params 会追加到 url 后面
* */
```