⼩程序中的tabBar设置我们先来看⼀份图,这个设置在官⽅⽂档中已经写得很清楚了,我只是做⼀个总结
注:我写注释是为了⽅便说明,在⼩程序中的json⽂件中是不能⽤注释的
这个tabBar属于全局属性,因此就在全局配置⽂件app.json中配置
1.tabBar的配置
"color": "#8a8a8a",
"selectedColor": "#f40",//选中的颜⾊
"backgroundColor": "#ffffff",//背景⾊
"borderStyle": "black",//边界线的颜⾊
"position":"top",//位置,是在上边。还是选择在下边,如果选择top,就不会显⽰图标
"list": [//组件的清单
{
"pagePath": "page/component/index",//页⾯路径
"text": "组件",//组件上显⽰的⽂字
"iconPath": "img/compont_un.png",//默认图标
"selectedIconPath": "img/compont_on.png"//选中后的图标
},
{
"pagePath": "page/API/index",
"text": "API",
"iconPath": "img/API_un.png",
"selectedIconPath": "img/API_on.png"
},
{
"pagePath": "page/persion/index",
selectediconpath什么意思
"text": "我的",
"iconPath": "img/我的_un.png",
"selectedIconPath": "img/我的_on.png"
},
{
"pagePath": "pages/logs/logs",
"text": "⽇志",
"iconPath": "img/⽇志.png",
"selectedIconPath": "img/⽇志_on.png"
}
]
},
最后再加⼀张图,如果你设置了在顶部显⽰,效果如下: