原生小程序的tabbar和uniApp里的tabbar绝大多数属性是一致的,但是uniApp里可能会有更多的属性设置。
在 pages.json 页面,写一个 tabBar 属性,属性值是我们定义的 tabbar
"tabBar": {
"color":"#2c2c2c", // 默认字体颜色
"selectedColor":"#d81e06", // 选中后字体颜色
"borderStyle":"white", // 边框颜色
"backgroundColor":"#ffffff", // 背景颜色
// list中最少两个对象,最多5个对象
"list":[{
"pagePath": "pages/index/index", // 页面路径
"iconPath":"static/images/tabbar/home.png", // tabbar图标
"selectedIconPath":"static/images/tabbar/home-selected.png",//选中当前tabbar图标
"text":"首页", // 文字
},
{
"pagePath":"pages/categories/categories",
"iconPath":"static/images/tabbar/categories.png",
"selectedIconPath":"static/images/tabbar/categories-selected.png",
"text":"分类"
}
}]
}