在 data 中自定义一个标记变量,在onLoad里
Page({ data: { isNewOpen: true, //判断当前页面是新打开还是从其他页面返回 list: [], page: 0 }, onLoad: function() { this.getList() }, getList () { // ... }, goDetail (e) { this.setData({ isNewOpen: false }) wx.navigateTo({ url: `/pages/detail/detail`, }) }, onShow: function () {if (!this.data.isNewOpen) { this.setData({ page: 2, // 页码 isClose: true, list: [] }) this.getList() } }, })