为了快速启动小程序,目前 tabBar 配置中暂时移除了图标路径,只保留了文字标签。小程序可以正常运行,但底部导航栏只显示文字。
在微信开发者工具中,tabBar 可以不配置图标,只显示文字即可正常使用。
如果需要图标,可以:
如果需要使用本地图标文件,需要:
images 文件夹准备以下图标文件(建议尺寸:81px × 81px):
home.png - 首页未选中图标home-active.png - 首页选中图标bookshelf.png - 书架未选中图标bookshelf-active.png - 书架选中图标profile.png - 我的未选中图标profile-active.png - 我的选中图标然后在 app.json 中恢复图标路径配置:
"tabBar": {
"color": "#7A7E83",
"selectedColor": "#667eea",
"borderStyle": "black",
"backgroundColor": "#ffffff",
"list": [
{
"pagePath": "pages/index/index",
"iconPath": "images/home.png",
"selectedIconPath": "images/home-active.png",
"text": "首页"
},
{
"pagePath": "pages/bookshelf/bookshelf",
"iconPath": "images/bookshelf.png",
"selectedIconPath": "images/bookshelf-active.png",
"text": "书架"
},
{
"pagePath": "pages/profile/profile",
"iconPath": "images/profile.png",
"selectedIconPath": "images/profile-active.png",
"text": "我的"
}
]
}
可以免费获取图标的地方:
目前 tabBar 配置为仅文字模式,功能完全正常,只是没有图标。如果需要添加图标,按照上述方案操作即可。