uni-app底部导航栏图标
时间: 2023-08-21 15:04:55 浏览: 114
要配置uni-app底部导航栏图标,首先需要准备好自己想要使用的图标,每个tab可以选择两个图标,分别为选中前的和选中后的。然后,根据uni-app官网提供的tabbar配置项进行配置。在pages数组中,每个页面需要指定其路径和样式,其中"navigationBarTitleText"表示导航栏标题文字内容,"enablePullDownRefresh"表示是否开启下拉刷新。默认页面的样式可以在globalStyle中设置,包括导航栏标题颜色、背景颜色等。最后,在tabBar配置项中,可以设置导航栏的边框样式、选中和未选中的颜色以及每个tab的页面路径、图标路径和文字内容。
以下是一个代码示例:
```json
"pages": [
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "配置底部导航栏"
}
},
{
"path": "pages/mine/mine",
"style": {
"navigationBarTitleText": "我的",
"enablePullDownRefresh": false
}
},
{
"path": "pages/cate/cate",
"style": {
"navigationBarTitleText": "分类",
"enablePullDownRefresh": false
}
}
],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "配置底部导航栏",
"navigationBarBackgroundColor": "#55aaff",
"backgroundColor": "#ffff7f"
},
"tabBar": {
"borderStyle": "black",
"selectedColor": "#FB7299",
"color": "#444444",
"list": [
{
"pagePath": "pages/index/index",
"iconPath": "static/tabbar/find.png",
"selectedIconPath": "static/tabbar/find-selected.png",
"text": "发现"
},
{
"pagePath": "pages/cate/cate",
"iconPath": "static/tabbar/cate.png",
"selectedIconPath": "static/tabbar/cate-selected.png",
"text": "分类"
},
{
"pagePath": "pages/mine/mine",
"iconPath": "static/tabbar/my.png",
"selectedIconPath": "static/tabbar/my-selected.png",
"text": "我的"
}
]
}
```
在以上示例中,pages数组中指定了三个页面的路径和样式,globalStyle中设置了默认页面的样式,tabBar配置项中设置了底部导航栏的样式和图标信息。你可以根据自己的需求进行调整和修改。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* *3* [【uniapp小程序】配置tabbar底部导航栏](https://blog.csdn.net/qq_49002903/article/details/126395789)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 100%"]
[ .reference_list ]
阅读全文