微信小程序api视频课程-路由-wx.switchTab(tab切换)的使用

wxml代码

wx.switchTab(Object object)
跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面

<button bindtap="tz">跳转tab页面</button>

<navigator url='/pages/index/index2' open-type='switchTab'>跳转tab页面</navigator>

js代码

  /**
   * 页面的初始数据
   */
  data: {

  },
  tz:function(e){
    wx.switchTab({
      url: '/pages/index/index2',
    })
  },

直接在自定义函数中调用api来进行跳转

欢迎大家收看我的****:微信小程序常用API使用

微信小程序api视频课程-路由-wx.switchTab(tab切换)的使用