tt.switchTab

2020-02-12 16:23 更新

跳轉(zhuǎn)到指定 TabBar 頁(yè)面。跳轉(zhuǎn)后原頁(yè)面棧內(nèi)所有非 TabBar 頁(yè)面會(huì)被關(guān)閉。

提示將要跳轉(zhuǎn)到的 TabBar 頁(yè)面需要在app.json中定義。


輸入

繼承標(biāo)準(zhǔn)對(duì)象輸入,擴(kuò)展屬性描述:

名稱數(shù)據(jù)類型屬性默認(rèn)值描述
urlstringrequiredN/A指定 TabBar 頁(yè)面的 url。不能攜帶參數(shù)。


輸出

各 callback 參數(shù)均無(wú)額外屬性


代碼示例

// pages/list
Page({
  onItemClick(event) {
    tt.switchTab({
      url: `pages/me`,
      success(res) {
        console.log(`${res}`);
      },
      fail(res) {
        console.log(`switchTab調(diào)用失敗`);
      }
    });
  }
});


以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)