var postData;
Page({
data: {
name:"1",
postlist: []
},
onLoad: function (options) {
var _this=this;
wx.request({
url: ‘http://localhost:8743/home/weixin‘,
data: {
x: ‘‘,
y: ‘‘
},
header: {
‘content-type‘: ‘application/json‘
},
success(res) {
postData = res.data;
console.log("postData");
console.log(postData);
_this.setData({
postlist: postData,
name: "2"
})
console.log("data");
console.log(_this.data);
}
})
},
onPostTap: function (event) {
var postId = event.currentTarget.dataset.postid;
wx:wx.navigateTo({
url: "post-detail/post-detail?id=" + postId
})
},
onSwiperTap(event) {
var postId = event.target.dataset.postid
wx.navigateTo({
url: ‘post-detail/post-detail?id=‘ + postId
})
},
})