dlt.switchTab
Introduction
This function allows you to navigate to a tabBar page and close all other non-tabBar pages.
Parameters
Object object
Property | Type | Default | Required | Description |
---|---|---|---|---|
url | string | Yes | The path (code package path) of the tabBar page to navigate to. It should be defined in the tabBar field of app.json . No parameters can be included in the path. | |
success | function | No | Callback function when the interface is successfully called | |
fail | function | No | Callback function when the interface call fails | |
complete | function | No | Callback function when the interface call ends (executed whether successful or failed) |
Sample Code
// app.json
{
"tabBar": {
"list": [{
"pagePath": "index",
"text": "首页"
},{
"pagePath": "other",
"text": "其他"
}]
}
}
// pages/index/index.js
Page({
switchTab() {
dlt.switchTab({
url: '/index',
});
},
});