【文件属性】:
文件名称:WepyUtils:小程序请求封装支持和promise,原生封装,请求拦截,封装header
文件大小:10KB
文件格式:ZIP
更新时间:2021-05-02 10:37:29
wepy JavaScript
WepyUtils
小程序请求封装支持和promise,原生封装,请求拦截,封装header
1.原生封装 httputils.js 不支持Promise 用法
1.引用
import httpUtils from '../../libs/httputils';
get请求
httpUtils.getReq('get/list', res=> {
//Success //已经回调成功数,无需判断判断
this.dataList = res.dataList;
this.$apply();
},res=>{
//error
});
post请求
httpUtils.postReq('user/login',res=> {
//Success //已经回调成功数
【文件预览】:
WepyUtils-master
----httputils.js(3KB)
----README.md(4KB)
----.idea()
--------misc.xml(279B)
--------workspace.xml(11KB)
--------vcs.xml(180B)
--------markdown-navigator()
--------modules.xml(270B)
--------markdown-navigator.xml(5KB)
--------WepyUtils.iml(458B)
----httputils2.js(3KB)