0.9.0 • Published 11 months ago
ljc-util v0.9.0
ljc-util
Request
简单包装的 Fetch
REQUEST API
- requestConfig 配置所有默认选项
- requestHeaders 设置 headers, 支持 object | key-value | function 类型参数
- send 发送请求
- getform, postform, get, post, head, del, put 发送请求(这些都是简化的 send)
- 支持 jsonp
- 下面为不在\$\$中的方法
- create 返回新实例
- config 同 requestConfig
- headers 同 requestHeaders
- prefix 设置请求前缀,可在 config 中设置
- beforeRequest 请求前 hook
- afterResponse 响应后 hook
- contentType 设置 content-type
Usage
import $$ from 'ljc-util';
$$.send('http://httpbin.org/post', {
method: 'POST',
data: { name: 'ailjc' },
}).then(resp => {
console.log(resp.json); // {name: 'ailjc'}
});
// 等价于,使用提供的post方法
$$.post('http://httpbin.org/post', { name: 'ailjc' }).then(resp => {
console.log(resp.json); // {name: 'ailjc'}
});
0.9.0
11 months ago
0.8.0
1 year ago
0.3.0
2 years ago
0.6.3
2 years ago
0.4.5
2 years ago
0.7.1
2 years ago
0.4.4
2 years ago
0.4.7
2 years ago
0.4.6
2 years ago
0.5.0
2 years ago
0.4.1
2 years ago
0.3.2
2 years ago
0.4.0
2 years ago
0.3.1
2 years ago
0.7.0
2 years ago
0.6.1
2 years ago
0.4.3
2 years ago
0.6.0
2 years ago
0.5.1
2 years ago
0.4.2
2 years ago
0.2.0
2 years ago
0.1.1
2 years ago
0.1.0
2 years ago