uni-app配置底部导航栏

https://uniapp.dcloud.io/collocation/pages?id=tabbar

直接在page.json中进行配置,四个参数均需要配置,所需要的图片必须是英文名字。

{
	"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
		{
			"path": "pages/index/index",
			"style": {
				"navigationBarTitleText": "微信"
			}
		}
	],
	"globalStyle": {
		"navigationBarTextStyle": "black",//导航栏颜色
		"navigationBarTitleText": "仿微信",//导航栏名称
		"navigationBarBackgroundColor": "#F8F8F8",
		"backgroundColor": "#F8F8F8",
		"app-plus":{
			// "titleNView":false,//取消原生导航
			"scrollIndicator":"none"//取消滚动条
		}
	},
	"tabBar":{
		"borderStyle":"black",//边框颜色
		"backgroundColor":"#F7F7F7",//背景颜色
		"color":"#000000",//默认颜色
		"selectedColor":"#07C160",//选中的颜色
		"list":[
			{
				"iconPath":"static/xiaoxi.png",
				"selectedIconPath":"static/xiaoxi1.png",
				"text":"消息",
				"pagePath":"pages/index/index"
			},
			{
				"iconPath":"static/faxian.png",
				"selectedIconPath":"static/faxian1.png",
				"text":"发现",
				"pagePath":"pages/tongxunlu"
			},
			{
				"iconPath":"static/tongxunlu.png",
				"selectedIconPath":"static/tongxunlu1.png",
				"text":"通讯录",
				"pagePath":"pages/faxian"
			},
			{
				"iconPath":"static/wo.png",
				"selectedIconPath":"static/wo1.png",
				"text":"我",
				"pagePath":"pages/wo"
			}
		]
	}
}

 

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
配置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 ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值