页面A:主页
页面B:分类
页面C:个人中心 (需要登陆)
页面D:登陆页面
ABC,分布都是 tabBar
A->C(需要登陆,跳转D页面),先D页面 我不想登陆,点击返回 ->跳回C页面,C(需要登陆,跳转D页面) 死循环 ,点C页面如何跳回A页面
B->C(需要登陆,跳转D页面),先D页面 我不想登陆,点击返回 ->跳回C页面,C(需要登陆,跳转D页面) 死循环 ,点C页面如何跳回B页面
C页面上级页面不确定, 用户的返回应该如何做?
页面A:主页
页面B:分类
页面C:个人中心 (需要登陆)
页面D:登陆页面
ABC,分布都是 tabBar
A->C(需要登陆,跳转D页面),先D页面 我不想登陆,点击返回 ->跳回C页面,C(需要登陆,跳转D页面) 死循环 ,点C页面如何跳回A页面
B->C(需要登陆,跳转D页面),先D页面 我不想登陆,点击返回 ->跳回C页面,C(需要登陆,跳转D页面) 死循环 ,点C页面如何跳回B页面
C页面上级页面不确定, 用户的返回应该如何做?
aiyide (作者)
当 A,C,都是tabBar 的时候 getCurrentPages 不记录 A页面, delta:2 ,是一步一步返回,当执行一次返回(到C页面还是会判断用登陆)结果又跳到D页面,返回不到A页面
2020-11-16 18:28
aiyide (作者)
getCurrentPages 只记录 switchTab 跳转的页面,很头疼, tabBar 之间的切换没有记录,
2020-11-16 18:31
DCloud_uniCloud_JSON
回复 aiyide: 提供个思路,给路由套一层方法,然后方法记录路由历史,顺历史记录跳到指定页面。
2020-11-16 18:35
aiyide (作者)
回复 DCloud_uniCloud_JSON: tabBar 怎么可以获取到记录,我尝试过很多,多获取不到
2020-11-16 21:38
DCloud_uniCloud_JSON
回复 aiyide: myNavigate(type,OBJECT){
switch (type){
case 'navigateTo':
uni.navigateTo(OBJECT)
break;
case 'redirectTo':
uni.redirectTo(OBJECT)
break;
......//其他方法同上
default:
break;
}
let historyNavigate = uni.getStorageSync('historyNavigate')
if(!historyNavigate){historyNavigate=[]}
historyNavigate.push(OBJECT.url)
historyNavigate = historyNavigate.slice(-5)//结果保留5步
uni.setStorageSync('historyNavigate',historyNavigate)
}
2020-11-17 10:19