Blogger Information
Blog 39
fans 1
comment 0
visits 62353
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
微信小程序 在设置了tabBar后,按钮点击 了没反应了
Dai的博客
Original
3527 people have browsed it
//在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

QQ截图20171213214740.png

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

QQ截图20171213215006.png

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post