onLoad: function (options) { let pages = getCurrentPages() if (pages.length >= 2) { let prevpage = pages[pages.length - 2] console.log(prevpage.route) } },
Page({ data: { isClose: true, //判断当前页面是打开还是返回页 list: [], page: 0 }, onLoad: function() { this.getList() }, getList () { // ... }, goDetail (e) { this.setData({ isClose: false }) wx.navigateTo({ url: `/pages/detail/detail`, }) }, onShow: function () { console.log(this.data.isClose) if (!this.data.isClose) { this.setData({ page: 2, // 页码 isClose: true, list: [] }) this.getList() } }, })