wx.switchTab跳转到 tabBar 页面 并关闭其他所有非 tabBar 页面

追格官方小助手/ 2022年12月31日/ 小程序/ 浏览 1219

wx.switchTab是一个微信小程序跳转到 tabBar 页面 并关闭其他所有非 tabBar 页面API。


需要注意的是需要页面权限:当前是插件页面时,宿主小程序不能调用该接口,反之亦然。


示例代码:


// app.json
{
  "tabBar": {
    "list": [{
      "pagePath": "index",
      "text": "首页"
    },{
      "pagePath": "other",
      "text": "其他"
    }]
  }
}

wx.switchTab({
  url: '/index'
})


参数介绍:



发表评论

暂无评论,抢个沙发...

客服 工单