页面跳转顺序:1商品详情页 > 2付款页面 > 付款成功跳转 3订单列表
此时订单列表页面返回 应该是 返回到第一个商品详情页面
再付款页面 跳转订单列表时 路由传一个值?router=2
这里只有router == 2 需要返回两级页面

进入订单列表时,我们希望返回的不是付款页面,需要通过onBackPress来监听页面返回

onBackPress(e){
	//APP安卓物理返回键逻辑
	if(e.from == 'backbutton'){
		this.goBack()
		return true
	}
},
onLoad(option) {
	this.router = option.router;
},

methods:{
	//页面跳转
	goBack(){
		if(this.router == 2){
			uni.navigateBack({
			delta: 2,
			animationType: 'pop-out',
			animationDuration: 300
		});
		}else{
			uni.navigateBack({
			delta: 1,
			animationType: 'pop-out',
			animationDuration: 300
		});
		}
	},
}
Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐