wx.request({
url: app.globalData.host + '/api/v1/giftCoupons/findById?giftCouponId='+ options.id,
method: 'GET', //方法分GET和POST,根据需要写
header: { //定死的格式,不用改,照敲就好
// 'Content-Type': 'application/json'
'Authorization': "Bearer " + wx.getStorageSync('token')
},
success: function(res) { //这里写调用接口成功之后所运行的函数
// that.resdata = res.data.data;
if (res.data.status == 200) {
that.resdata = res.data.data;
console.log(that.resdata,"zhuanzenglkink");
console.log(that.resdata.goodImage,"tupian");
that.setData({
resdata: that.resdata,
})
}
},
fail: function(res) { //这里写调用接口失败之后所运行的函数
console.log('.........fail..........');
}
})
小程序调取接口代码实例
最新推荐文章于 2024-09-06 14:55:10 发布