# switchTab

跳转到指定 TabBar 页面,并关闭其他所有非 TabBar 页面。

注意

将要跳转到的 TabBar 页面需要在app.json中定义。

# 支持说明

应用能力 Android iOS PC 预览效果
小程序 3.0.0 3.0.0 3.2.0
扫码预览
用BoosHi扫码或PC端点击
网页应用 X X X /

# 输入

继承标准对象输入,扩展属性描述:

名称 数据类型 必填 默认值 描述
url string 需要跳转的 TabBar 页面的路径。路径后不能携带参数
示例值:/page/API/index

# 输出

继承标准对象输出,无扩展属性

# 示例代码

bz.switchTab({
    "url": "/pages/api/index",
    success(res) {
      console.log(JSON.stringify(res));
    },
    fail(res) {
      console.log(`switchTab fail: ${JSON.stringify(res)}`);
    }
});
1
2
3
4
5
6
7
8
9

返回值示例:

{"errMsg":"switchTab:ok"}
1
最后更新于 : 12/15/2022, 2:18:25 PM