import { customerLogPage } from '../../api/index' Page({ /** * 页面的初始数据 */ data: { activeTabs: '1', dataList: [], total: 0, page: 1, capacity: 10, }, onLoad(options) { this.getList() }, onReachBottom() { console.log('触底事件'); const { total, dataList, page } = this.data if(total > dataList.length){ this.setData({ page: page + 1 }) this.getList() }else{ wx.showToast({ title: '暂无更多数据', icon: 'none' }) } }, getList() { const { page, capacity, activeTabs} = this.data customerLogPage({ model: { type: activeTabs },page,capacity }).then(res => { this.setData({ dataList: res.data.records, total: res.data.total, }) }) }, tabsChange(e) { const activeTabs = e.currentTarget.dataset.val this.setData({ activeTabs, dataList: [], total: 0, page: 0, }) this.getList() } })