1.wx.request请求数据
index.js文件
onLoad: function () {
var that = this;
wx.request({
url: 'https://route.showapi.com/90-87?######=f1161d6416e74e1b821485dd8554ef6b&tid=###',//要遍历的url,http没有数据的话用https
error: function (XmlHttpRequest, textStatus, errorThrown) {
alert("操作失败!");
},
success: function (result) {
var postList = result.data.showapi_res_body.pagebean.contentlist;
console.log(postList);
that.setData({ indexDate: postList });
}
})
}
打印的数据如下: