路由跳转传参
有两种方式
- 通过标签
<navigator url=`要跳转的路径?id=${id}`>
- 编程式触发
wx.navigateTo() 带历史回退
wx.redirectTo() 不保留历史,跳转到另一个页面,不能返回到上一页面
wx.switchTab() 只跳转到tabBar页面,不带回退
wx.reLaunch() 即能跳转到tabBar页面,也能跳转到非tabBar页面,不带历史回退、
3.今天遇到问题
在使用wx.navigateTo()传参时报错
(in promise) MiniProgramError
{“errMsg”:“navigateTo:fail can not navigateTo a tabbar page”}
Object
检查发现是使用wx.navigateTo()的url路径不可以与tabBar路径相同
去除tabBar路径问题解决