| | |
| | | |
| | | dataList: [], |
| | | total: 0, |
| | | pageNum: 1, |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | }, |
| | | onLoad(options) { |
| | | this.getList() |
| | | }, |
| | | onReachBottom() { |
| | | if(this.data.total > this.data.dataset.length){ |
| | | this.setData({ pageNum: this.data.pageNum + 1 }) |
| | | console.log('触底事件'); |
| | | const { total, dataList, pageNum } = this.data |
| | | if(total > dataList.length){ |
| | | this.setData({ pageNum: pageNum + 1 }) |
| | | this.getList() |
| | | }else{ |
| | | wx.showToast({ |
| | | title: '暂无更多数据', |
| | | icon: 'none' |
| | | }) |
| | | } |
| | | // this.pageN |
| | | }, |
| | | tabsChange(e) { |
| | | const activeTabs = e.currentTarget.dataset.val |
| | |
| | | }).then(res => { |
| | | if (res.data) { |
| | | this.setData({ |
| | | dataList: [...this.data.dataset, ...res.data.records || []], |
| | | dataList: [...this.data.dataList, ...res.data.records || []], |
| | | total: res.data.total |
| | | }) |
| | | } |