redirectTo:关闭当前页(卸载),跳转到指定页
navigateTo:保留当前页(隐藏),跳转到指定页
switchTap:只能用于跳转到tabbar页面,并关闭其他非tabbar页面,tabbar之间做切换
// 监听页面返回
onBackPress(event) {
console.log("111");
if (event.from == "backbutton") {
console.log("111");
uni.redirectTo({
url: "/pages/sfc/line-receive/index",
});
return true
}
},
uni.navigateTo({
url:
`/pages/sfc/line-receive/detail?id=` +
JSON.stringify(this.detaildata),
animationType: "pop-in",
animationDuration: 200,
});

这篇博客讨论了移动端应用中页面跳转的三种方法:redirectTo、navigateTo和switchTab,以及如何监听并处理页面返回事件。在onBackPress事件中,当从后退按钮触发时,博客展示了如何关闭当前页面并跳转到指定页面。同时,文章还演示了使用uni.navigateTo进行页面跳转的示例。
860

被折叠的 条评论
为什么被折叠?



