HomeDocs
Skip to main content

dlt.switchTab

Introduction

This function allows you to navigate to a tabBar page and close all other non-tabBar pages.

Parameters

Object object

PropertyTypeDefaultRequiredDescription
urlstringYesThe 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.
successfunctionNoCallback function when the interface is successfully called
failfunctionNoCallback function when the interface call fails
completefunctionNoCallback 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',
});
},
});
Privacy agreementDeveloper agreementcontact us: developer_service.mi@transsion.com © 2024 MiniApp. All Rights Reserved.