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

版权声明:黄菊华 https://blog.csdn.net/u013818205/article/details/88655655

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使用
https://edu.csdn.net/course/detail/16194
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/u013818205/article/details/88655655