小程序路由tab頁跳轉wx.switchTab
wx.switchTab(Object object)
跳轉到 tabBar 頁面,并關閉其他所有非 tabBar 頁面
參數(shù)
Object object
屬性 類型 默認值 必填 說明
url string 是 需要跳轉的 tabBar 頁面的路徑 (代碼包路徑)(需在 app.json 的 tabBar 字段定義的頁面),路徑后不能帶參數(shù)。
success function 否 接口調用成功的回調函數(shù)
fail function 否 接口調用失敗的回調函數(shù)
complete function 否 接口調用結束的回調函數(shù)(調用成功、失敗都會執(zhí)行)
示例代碼
// app.json
{
"tabBar": {
"list": [{
"pagePath": "index",
"text": "首頁"
},{
"pagePath": "other",
"text": "其他"
}]
}
}
wx.switchTab({
url: '/index'
})
作者:大學生新聞網(wǎng) 來源:大學生新聞網(wǎng)
- 小程序wx.getSystemInfo
- 獲取系統(tǒng)信息。由于歷史原因,wx.getSystemInfo 是異步的調用格式,但是是同步返回,需要異步獲取系統(tǒng)信息請使用 wx.getSystemInfoAsy
- 04-02 關注:0