aa
jiangping
2024-08-02 7dc29ed74ebaa8a0e66f68264d9a13f95dc3af21
wechat_jiaxuan/pages/homeId/index.js
@@ -39,6 +39,7 @@
  onPullDownRefresh: function () {
    console.log('下拉刷新');
    this.setData({ dataList: [], pageNum: 1, total: 0 })
    wx.stopPullDownRefresh()
    this.getList()
  },
  getList(){
@@ -53,10 +54,19 @@
        total: res.data.total,
        dataList: [ ...this.data.dataList, ...res.data.records ]
      })
    }).finally(()=>{
      wx.stopPullDownRefresh()
    })
  },
  itemClick(e) {
    const item = e.currentTarget.dataset.item
    const { dataList } = this.data
    dataList.forEach(ite => {
      if(item.id === ite.id){
        ite.viewCount += 1
      }
    })
    this.setData({ dataList })
    if(item.contentType){
      actionDo({actionType: 'view',id: item.id})
    }