微信小程序返回上一页的时候,重新请求上一页的某个接口:【关键在onShow生命周期中处理】

337 阅读1分钟
onShow,监听页面的显示,与onLoad不同,如果页面被隐藏后再次显示(例如:进入下一页后返回),也会触发该生命周期;

async onShow(){

            console.log('上一页回来本页');

            let res = await this.getEquipDetail();

            this.equipdetaildata = res.data; //刷新页面数据

},