使用promise封装请求,request.getParameter('key')取不到值?
export default function commonRequest(options) {
return new Promise((resolve, reject) => {
wx.request({
url: options.url,
method: options.method || ‘GET’,
data: options.data || {},
header: {
“Content-Type”: “application/json”
},
success: function(res) {
console.log(res)
resolve(res)
},
fail: function(err) {
console.log(err)
reject(err)
}
})
})
}