微信小程序向后台发起请求非常简单,格式如下
wx.request({url: '/artilces',header: {'content-type': 'application/json'},method: 'GET',//get或者postdata: { //请求参数,没有参数可以为空findtext: findtext //查询字符串},success: function (res) {console.log(res)//接口返回值that.setData({results: res.data.data})}})