刷新当前页面:
// 首先判断当前页面加载的所有页面的数组,数组中最后一个就是当前页面,然后onload当前页面。
if (getCurrentPages().length != 0) {
//刷新当前页面的数据
getCurrentPages()[getCurrentPages().length - 1].onLoad()
}刷新当前页面并跳转到指定页面:这里以跳转到tobar页面为演示:
// 首先判断当前页面加载的所有页面的数组,数组中最后一个就是当前页面,然后onload当前页面。
if (getCurrentPages().length != 0) {
//刷新当前页面的数据
getCurrentPages()[getCurrentPages().length - 1].onLoad()
// 关闭当前页面,跳转到应用内的某个页面。
wx.switchTab({
url: '/pages/new/new'
})
}