uni.switchTab(OBJECT)
跳转到tabbar页面,并关闭其他所有非tabbar页面。
OBJECT参数说明
| 参数 | 类型 | 必填 | 说明 | 平台支持 |
|---|---|---|---|---|
| url | String | 是 | 需要跳转的 tabbar 的页面的路径(需要在appmap.json的tabbar字段中定义) , 路径后不可以带参数 | all? |
| success | Function | 否 | 接口调用成功的回调函数 | all? |
| fail | Function | 否 | 接口调用失败的回调函数 | all? |
| complete | Function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | all? |
示例
{
"tabbar": {
"list": [{
"pagePath": "index",
"text": "首页"
},{
"pagePath": "other",
"text": "其他"
}]
}
}
uni.switchTab({
url: '/index'
})