1. When returning to the previous page, you need to pass the data to the corresponding parameter value in the data of the next page
Page B
pageBack(){//放到返回上一页方法或成功的回调里面
var pages = getCurrentPages();
var prevPage = pages[pages.length - 2]; //上一个页面
//直接调用上一个页面的setData()方法,把数据存到上一个页面中去
prevPage.setData({
currentTab:0 //currentTab为上一页的data参数值,现在要一返回上一页就把其初始值为0
})
}
A page
data:{
currentTab:0
}