请求方法
call_fun: function (args) {
var url = app.globalData.api_url + args.name;
return new Promise((resolve, reject) => {
wx.request({
url: url,
method: 'POST',
data: {
...args.data
},
success: resolve,
fail: reject
})
})
},
调用
load_sync: async function () {
console.log(1);
await app.call_fun({
name: 'm=Test&a=test',
data: {
t: 'fewafewa',
fewa: 'fewafewa',
}
}).then(function (params) {
console.log(params);
});
console.log(2);
},