1.使用wx.switchTab跳轉至tabbar的某一頁面
wx.switchTab({
url: '../b/b'
});
2.如頁面不帶tab,使用wx.navigateTo跳轉至tabbar頁面
wx.navigateTo({
url: '../b/b'
});
wx.redirectTo({
url: '../b/b'
});
3.在app.json文件中設置tabBar屬性
"tabBar": {
"selectedColor": "red",
"list": [
{
"pagePath": "pages/index/index",
"text": "首頁",
"iconPath": "pages/images/tab/headline-0.jpg",
"selectedIconPath": "pages/images/tab/headline-1.jpg"
},
{
"pagePath": "pages/tabbar/tabbar",
"text": "關閉當前頁打開導航",
"iconPath": "pages/images/tab/me-0.jpg",
"selectedIconPath": "pages/images/tab/me-1.jpg"
}
]
}