微信小程序tabBar不显示的问题
2016年12月7日微信小程序 Standard
刚接触小程序,发现根据官网配置app.json后死活不出现下方tabBar。总结一下这里面的坑
1、必要属性检查。tabBar中color、selectedColor、backgroundColor、list四个属性是必填的!
2、list最少2个,最多5个
3、也是最坑的一个,pages数组的第一项必须在list中,我测试的时候就死在这里
示例:
{
"pages":[
"pages/index/index",(第一项必须为list中任意一个元素的pagePath)
"pages/logs/logs",
"pages/function/function",
"pages/pay/pay",
"pages/account/account"
],
"tabBar": {
"color": "#dddddd",
"selectedColor": "#3cc51f",
"borderStyle": "black",
"backgroundColor": "#ffffff",
"list": [{
"pagePath": "pages/logs/logs",
"iconPath": "assets/images/icon_component.png",
"selectedIconPath": "assets/images/icon_component_HL.png",
"text": "组件"
}, {
"pagePath": "pages/index/index",
"iconPath": "assets/images/icon_API.png",
"selectedIconPath": "assets/images/icon_API_HL.png",
"text": "接口"
}]
},
"window":{
"navigationBarBackgroundColor": "#6595e9",
"navigationBarTextStyle":"white",
"navigationBarTitleText": "Vision's Program",
"backgroundColor": "#eeeeee",
"backgroundTextStyle":"light"
}
}
PS:后来还注意到有些小伙伴把”tabBar”写成”tabbar”导致不显示的,要细心哟~
发表评论或回复