小程序循环东西修改后显示

时间:2019-01-05 19:55:27   收藏:0   阅读:161
toRevocateMark: function(event) {
    console.log(event);
    var index = event.currentTarget.dataset.index;
    var i = parseInt(index);
    var newss = this.data.newss;
    var that = this;
    wx.request({
      url: app.globalData.baseurl + ‘api/news/revocateMark‘,
      header: {
        ‘token‘: wx.getStorageSync(‘token‘) // 默认值
      },
      data: {
        markid: newss[i].id
      },
      success: function(res) {
        console.log(res)
        wx.showToast({
          title: ‘取消成功‘,
          icon: ‘none‘,
          duration: 2000
        });
        newss[i].isMark = 0;
        that.setData({
          ‘newss‘: newss
        })
      }
    })
  }

  

<text bindtap="toRevocateMark" data-index="{{index}}" wx:else>取消收藏</text>

  

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!