//在app.json下面添加了“tabBar”后,跳转到登录页面后,输入账号,密码点击 登录 后,没有反应
//这个时候需要把 wx.redirectTo 与wx.navigateTo 换成wx.switchTab 才可以正常跳转
loginBtn : function(){
app.globalData.userInfo = { userName: this.data.userName, password: this.data.password };
wx.switchTab({
url: '../user/user',
})
// console.log(app.globalData.userInfo);
}原因:
1、在官方小程序的文档API中介绍了
wx.redirectTo 与wx.navigateTo 需要跳转的应用内非 tabBar 的页面的路径,路径后可以带参数。
官方文档传送门:https://mp.weixin.qq.com/debug/wxadoc/dev/api/ui-navigate.html#wxredirecttoobject

2、所以,在有tabBar页面的跳转需要使用wx.switchTab这个API

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号