Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

WeChat program API jumps to tabBar page


May 19, 2021 WeChat Mini Program Development Document


Table of contents


wx.switchTab(Object object)

Jump to the tabBar page and close all other non-tabBar pages

Parameters

Object object

Property Type The default Required Description
Url string Is The path to the tabBar page that needs to be jumped (code pack path) (the page that needs to be defined in app.json's tabBar field) cannot be followed by parameters.
success function Whether The interface calls a successful callback function
fail function Whether The interface calls the failed callback function
complete function Whether Callback function at end of interface call (call succeeds, fails are executed)

The sample code

{
  "tabBar": {
    "list": [{
      "pagePath": "index",
      "text": "首页"
    },{
      "pagePath": "other",
      "text": "其他"
    }]
  }
}
wx.switchTab({
  url: '/index'
})