wx.request({
url: '******', //这里填写你的接口路径
header: { //这里写你借口返回的数据是什么类型,这里就体现了微信小程序的强大,直接给你解析数据,再也不用去寻找各种方法去解析json,xml等数据了
'Content-Type': 'application/json'
},
data: {//这里写你要请求的参数
x: '' ,
y: ''
},
success: function(res) {
//这里就是请求成功后,进行一些函数操作
console.log(res.data)
}
success: (data)=> {
})
},
fail: () => {
this.setData({
abc: '123456'
})
}
})
url: '******', //这里填写你的接口路径
header: { //这里写你借口返回的数据是什么类型,这里就体现了微信小程序的强大,直接给你解析数据,再也不用去寻找各种方法去解析json,xml等数据了
'Content-Type': 'application/json'
},
data: {//这里写你要请求的参数
x: '' ,
y: ''
},
success: function(res) {
//这里就是请求成功后,进行一些函数操作
console.log(res.data)
}
})
wx.request({
url: 'http://11111111111111/test.json',success: (data)=> {
this.setData({
data: data.data.result})
},
fail: () => {
this.setData({
abc: '123456'
})
}
})