打开app.json页面,在window下写下面的代码
//tabBar 指底部的 导航配置属性
//color 未选择时 底部导航文字的颜色
//selectedColor 选择时 底部导航文字的颜色
//borderStyle 底部导航边框的样色(注意 这里如果没有写入样式 会导致 //导航框上边框会出现默认的浅灰色线条)
//list 导航配置数组
//selectedIconPath 选中时 图标路径
//iconPath 未选择时 图标路径
//pagePath 页面访问地址
//text 导航图标下方文字
"tabBar": {
"color": "#909192",
"selectedColor": "#ebb656",
"list": [
{
"pagePath": "pages/home/home",
"text": "首页",
"iconPath": "/images/tabbar/00bar-1-old.png",
"selectedIconPath": "/images/tabbar/00bar-1-new.png"
},
{
"pagePath": "pages/product/product",
"text": "热销产品",
"iconPath": "/images/tabbar/00bar-2-old.png",
"selectedIconPath": "/images/tabbar/00bar-2-new.png"
},
{
"pagePath": "pages/new/new",
"text": "新品特惠",
"iconPath": "/images/tabbar/00bar-3-old.png",
"selectedIconPath": "/images/tabbar/00bar-3-new.png"
},
{
"pagePath": "pages/about/about",
"text": "联系我们",
"iconPath": "/images/tabbar/00bar-4-old.png",
"selectedIconPath": "/images/tabbar/00bar-4-new.png"
}
]
}
这里需要注意一些小问题:
1、每个页面的json文件都不能去掉navigationBarTitleText这个属性。否则会报错
2、"pages":[
"pages/index/index",
"pages/logs/logs",
"pages/mine/mine"
],
这个页面的注册一定要注意,第一个一定是要是最先显示的,否则会出现底部导航看不到。