更新记录

1.0.2(2019-06-29)

unifly更新日志

1.0.2版本
  1. 基于Fly封装
  2. 支持Promise API
  3. 拦截请求和响应
  4. 转换请求和响应数据
  5. 支持默认请求前缀

平台兼容性

使用方式

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)
  })

隐私、权限声明

1. 本插件需要申请的系统权限列表:

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

许可协议

MIT协议

使用中有什么不明白的地方,就向插件作者提问吧~ 我要提问