app.json 中已经配置了图标路径,但需要确保图标文件存在。
访问图标库网站:
搜索并下载图标:
准备图标文件(需要6个文件):
images/home.png - 首页未选中(灰色,81x81px)images/home-active.png - 首页选中(主题色 #667eea,81x81px)images/bookshelf.png - 书架未选中(灰色,81x81px)images/bookshelf-active.png - 书架选中(主题色 #667eea,81x81px)images/profile.png - 我的未选中(灰色,81x81px)images/profile-active.png - 我的选中(主题色 #667eea,81x81px)images 文件夹使用 Photoshop、GIMP 或在线编辑器创建 81x81px 的 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": "我的"
}
]
}
IconFont (https://www.iconfont.cn/)
Iconfinder (https://www.iconfinder.com/)
Flaticon (https://www.flaticon.com/)
images 目录下app.json 中配置的路径完全一致