static content can be displayed, but content obtained by ajax cannot be displayed
< H2 > app.js < / H2 >commented to get user information
//
// wx.getSetting({
// success: res => {
// if (res.authSetting["scope.userInfo"]) {
// // getUserInfo
// wx.getUserInfo({
// success: res => {
// // res unionId
// this.globalData.userInfo = res.userInfo
// // getUserInfo Page.onLoad
// // callback
// if (this.userInfoReadyCallback) {
// this.userInfoReadyCallback(res)
// }
// }
// })
// }
// }
// })
< H2 > the requested url is configured < / H2 >
getData: function () {
var that = this;
wx.request({
url: "https://cnodejs.org/api/v1/topics?page=" + this.data.page + "&tab=" + this.data.tab,
method: "get",
header: {
"Content-Type": "json"
},
success: function (res) {
that.setData({
topsData: res.data.data
})
}
})
},