WeChat applet jumps to the tabbar page-step on the pit

Reprinted from: https://blog.csdn.net/weixin_46363283/article/details/106716436
In the WeChat applet, there are five route jumps:

wx.switchTab()
wx.reLaunch()
wx.redirectTo()
wx.navigateTo()
wx.navigateBack()

The official website is relatively clear.

解决从 页面中无tabbar 跳转 带有tabbar的页面
还是以上的代码,实现从 无tabbar页面 跳转 有tabbar页面

Method:
In the page displayed by the applet by default, here is the welcome page, bind an event through bindtap, and then resolve it through the jump route API given by the applet;

  onTap: function(e) {
    
    

    //在这里不能用navigateTo或者redirectTo,官网文档,这两个指定跳转到一个页面,但是不能跳转到tabbar页面,
    // 这个项目app.json中,pages中首先显示的是welcome页面,但是在tabbar配置中,首个是posts页面, 不符合逻辑,
    //所以在首先显示的welcome页面中,不会显示tabbar,则这里就成了从无tabbar页面跳转到有tabbar页面,所以这两个路由跳转不可以用
    wx.reLaunch({
    
    
      url: '../posts/posts'
    })
  },

Guess you like

Origin blog.csdn.net/qq_43030934/article/details/115304295