小程序请求接口封装函数

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(){}
})
}
posted @ 2018-11-12 22:48  金牛座的女孩  阅读(369)  评论(0编辑  收藏  举报