const app = getApp(); Page({ data: { list: [] as any[], pagination: { page: 1, pages: 1, count: 1, }, }, onLoad() { app.waitLogin().then(() => { this.getList(); wx.setNavigationBarTitle({ title: '消息(20)', }); }); }, getList(newPage = 1) { wx.ajax({ method: 'GET', url: '?r=xd/doctor/index/get-msg-list', data: { page: newPage, }, }).then((res) => { const list = res.page === 1 ? res.list : [...this.data.list, ...res.list]; this.setData({ total: res.count, list, pagination: { page: res.page, pages: res.pages, count: res.count, }, }); }); }, onReachBottom() { const { page, pages } = this.data.pagination; if (pages > page) { this.getList(page + 1); } }, }); export {};