【文件属性】:
文件名称:Charlotte微信小程序开发(二)--网络请求
文件大小:28KB
文件格式:PDF
更新时间:2021-03-29 18:04:29
Charlotte,微信,小,程序开发,(,二,),--,网
微信小程序中request函数的封装
将函数写在app.js中,在其他页面引用函数:
//http方法,写在app.js页面
----------
http: function (msg) {
return new Promise((resolve, reject) => {
wx.request({
url: msg.url,
data: msg.data,
method: msg.method,
success: function (res) {
if (res.data.statu