时间:2022-12-06 01:20
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"
}
]
}