小程序点赞

  dianzan(e){
    let isdz=e.currentTarget.dataset.isdz;
    let id = e.currentTarget.dataset.isid;
    if (isdz==0){
      businessRequest.getData('Home/newsPraise', this, {
        index:4,
        id:id
      }, res => {
        if (res.code == 1) {
          let index = e.currentTarget.dataset.index;
          this.data.list[index].is_interactive = 1;
          this.data.list[index].fabulous_num += 1;
          this.setData({
            list: this.data.list
          })
        }
      })
    }else{
      businessRequest.getData('Home/RemoveNewsPraise', this, {
        index: 4,
        id:id
      }, res => {
        if (res.code == 1) {
          let index = e.currentTarget.dataset.index;
          this.data.list[index].is_interactive=0;
          this.data.list[index].fabulous_num -=1;
          this.setData({
            list:this.data.list
          })
        }
      })
    }
  },

 

  
                {{item.fabulous_num}}

 

你可能感兴趣的:(小程序)