实现功能:账号切换后返回列表页,根据拿到的数据再次进行数据查询。
思路:可以使用异步本地存储,存储一个值,返回后在onShow周期函数中异步拿取并注销。
(1)返回方法back()中写
try {
uni.setStorageSync('jumpTo', true);
} catch (e) {
// error
}
uni.switchTab({
url: '../../orderList/index/index'
});
this.show = false // 关闭 pop弹窗
(2)跳转的页面拿取成功后删除注销
(注意:如果要有数据拼接的话,要把赋值的数组清空)
onShow() {
try {
const value = uni.getStorageSync('jumpTo');
if (value) {
this.method3List = []
this.getList()
try {
uni.removeStorageSync('jumpTo');
} catch (e) {
// error
}
}
} catch (e) {
// error
}
},