小程序请求接口封装函数

时间:2018-11-13 02:56:11   收藏:0   阅读:305
function RequestUrl(url, data, method, success, fail, complete) {
wx.request({
url: url,
data: data ? data : {},
header: {
‘content-type‘: ‘application/json‘,
‘Accept‘: ‘application/json‘
},
method: method ? method : ‘GET‘,
success: success ? success : function(){},
fail: fail ? fail : function(){},
complete: complete ? complete : function(){}
})
}
评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!