更新记录
1.0.2(2019-06-29) 下载此版本
unifly更新日志
1.0.2版本
- 基于Fly封装
- 支持Promise API
- 拦截请求和响应
- 转换请求和响应数据
- 支持默认请求前缀
平台兼容性
使用方式
uni-app框架中
安装(项目根目录下运行)
npm install unifly --save
文件中引用
import uniFly from 'unifly';
使用方法
全局配置
uniFly.baseUrl = 'https://yourapi.domain.com';
uniFly.headers.common['Authorization'] = AUTH_TOKEN;
uniFly.headers['Content-Type'] = 'application/x-www-form-urlencoded';
发送get请求
uniFly
.get({
url: 'info/5ca854ca82de0949287feeed',
params: data
})
.then(function(response) {
console.log(response)
})
.catch(function(error) {
console.log(error)
})
发送post请求
uniFly
.post({
url: 'model',
params: data
})
.then(function(response) {
console.log(response)
})
.catch(function(error) {
console.log(error)
})

收藏人数:
https://github.com/QzeroQ/uniFly
https://www.npmjs.com/package/unifly
下载插件并导入HBuilderX
下载插件ZIP
赞赏(0)
下载 219
赞赏 0
下载 11036018
赞赏 1800
赞赏
京公网安备:11010802035340号