按照官方自定义tabBar:
- 配置信息
在 app.json 中的 tabBar 项指定 custom 字段,同时其余 tabBar 相关配置也补充完整。
所有 tab 页的 json 里需声明 usingComponents 项,也可以在 app.json 全局开启。
我的示例:
{
"tabBar": {
"custom": true,
"color": "#a9b7b7",
"selectedColor": "#11cd6e",
"borderStyle": "black",
"list": [
{
"pagePath": "pages/index/index",
"iconPath": "images/tabbar/home0.png",
"selectedIconPath": "images/tabbar/home1.png",
"text": "首页"
},
{
"pagePath": "pages/my/index",
"iconPath": "images/tabbar/my0.png",
"selectedIconPath": "images/tabbar/my1.png",
"text": "我的"
}
]
-
添加 tabBar 代码文件
在代码根目录下添加入口文件 custom-t