小程序的网路请求赋值
            时间:2019-11-25 18:10:41  
            收藏:0  
            阅读:106
        
        
        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
    })
  },
})
            评论(0)
        
        
        