1. 路由跳转
pages前要加/
uni.navigateTo({
url: '/pages/home/home'
});
2. 配置tabbar:
pages.json文件pages要和tabBar--list的第一个路径相同,否则会不显示
{
"pages": [{
"path": "pages/home/home",
"style": {
"navigationBarTitleText": "主页"
}
},
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "aicrane-mobile"
}
},
{
"path": "pages/device/device",
"style": {
"navigationBarTitleText": "设备"
}
},
{
"path": "pages/statistic/statistic",
"style": {
"navigationBarTitleText": "统计"
}
},
{
"path": "pages/management/management",
"style": {
"navigationBarTitleText": "管理"
}
},
{
"path": "pages/user/user",
"style": {
"navigationBarTitleText": "个人"
}
}
],
"tabBar": {
"list": [{
"pagePath": "pages/home/home",
"text": "主页",
"iconPath": "static/c1.png"
},
{
"pagePath": "pages/device/device",
"text": "设备",
"iconPath": "static/c2.png"
},
{
"pagePath": "pages/statistic/statistic",
"text": "统计",
"iconPath": "static/c3.png"
},
{
"pagePath": "pages/management/management",
"text": "管理",
"iconPath": "static/c4.png"
},
{
"pagePath": "pages/user/user",
"text": "个人",
"iconPath": "static/c5.png"
}
]
},
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-app",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8",
"app-plus": {
"background": "#efeff4"
}
}
}