// index.js import { rechargeList } from "@/api/my"; Page({ data: { list: null, loadStatus: "loading", // loading loadmore nomore isEdit: false, page: 1, map: { 0: "未支付", 1: "已支付", 4: "已退款", }, }, onLoad() { this.getList({ page: this.data.page, }); }, //监听下拉刷新 async onPullDownRefresh() { console.log("监听用户下拉刷新"); var _this = this; this.setData({ list: [], loadStatus: "loading", }); wx.stopPullDownRefresh(); this.getList({ page: 1, }); }, // 监听上拉加载 async onReachBottom() { console.log("监听用户上拉加载"); if (this.data.loadStatus !== "nomore") { this.setData({ loadStatus: "loading", }); this.getList({ page: this.data.page, }); } }, // 接口调用 getList(even) { const _this = this; setTimeout(async () => { const list = await rechargeList(even); _this.setData({ loadStatus: list.length < 10 ? "nomore" : "loadmore", list: (_this.data.list || []).concat(list), page: even.page + 1, }); }, 200); }, });