有的时候在app.json中定义好了Tabbar,但是页面却怎么也不显示。
原因:在定义app.json中有page、和tabbar两个参数
{
"pages":[
"pages/item/item",
"pages/tag/tag",
"pages/discuss/discuss",
"pages/chatting/chatting"
],
"tabBar": {
"color": "#ffffff",
"selectedColor": "#00E5FF",
"backgroundColor": "#607D8B",
"borderStyle": "#000000",
"list": [
{
"iconPath": "./image/tabbar/item.png",
"selectedIconPath": "./image/tabbar/item_s.png",
"pagePath": "pages/item/item",
"text": "文章"
},
{
"iconPath": "./image/tabbar/tag.png",
"selectedIconPath": "./image/tabbar/tag_s.png",
"pagePath": "pages/tag/tag",
"text": "标签"
},
{
"iconPath": "./image/tabbar/discuss.png",
"selectedIconPath": "./image/tabbar/discuss_s.png",
"pagePath": "pages/discuss/discuss",
"text": "讨论"
},
{
"iconPath": "./image/tabbar/chatting.png",
"selectedIconPath": "./image/tabbar/chatting_s.png",
"pagePath": "pages/chatting/chatting",
"text": "分享"
}
]
}
}
原因就在page中的第一个页面没在tabbar中。(就这么简单的原因)
解决办法就是把list中的页面放在page的第一位。