uniapp(2)自定义tabbar

创建tabbar

1、系统用的tabbar

javascript 复制代码
"tabBar": {
		"selectedColor": "#00b5ff",//选中的文字颜色
		"fontSize": "20rpx",//字体大小
		"height": "130rpx",//高度
		"list": [
			{
				"pagePath":"pages/home/home",
				"text": "首页",
				"selectedIconPath": "static/ic_home_col.png",//选中的图标样式
				"iconPath": "static/ic_home_gray.png"
				
			},
			{
				"pagePath":"pages/mission/mission",
				"text": "任务广场",
				"iconPath": "static/ic_guangchang_gray.png",
				"selectedIconPath": "static/ic_guangchang_col.png"
				
			},
			{
				"pagePath": "pages/myMission/myMission",
				"text": "我的任务",
				"iconPath": "static/ic_task_gray.png",
				"selectedIconPath": "static/ic_task_col.png"
				
			},{
				"pagePath": "pages/my/my",
				"text": "我的",
				"selectedIconPath": "static/ic_mine_col.png",
				"iconPath": "static/ic_mine_gray.png"
				
			}
		]
	}

2、使用组件tabbar或者自定义tabbar

这里使用uView的自定义tabbar

在需求中,有点击选中未选中icon的样式大小,文字大小还有tabbar的高度问题,

利用view在tabbar外包一层,设置需要的高度,颜色设置成组件一致颜色

利用slot进行独立配置是否激活状态

html 复制代码
<view class="bottomBar">
		<u-tabbar :value="value" @change="name => value = name" 
:fixed="fase" :placeholder="true"
			activeColor="#00adff" 
:safeAreaInsetBottom="false">
			<u-tabbar-item text="首页">
				<view class="push_icon" slot="active-icon">
				<u-image src="/static/ic_home_col.png" 
width="16px" height="16px">
</u-image>
				</view>
				<view slot="inactive-icon">
					<u-image src="/static/ic_home_gray.png"
 width="16px" height="16px">
</u-image>
				</view>
				</u-tabbar-item>
				<u-tabbar-item text="任务广场"></u-tabbar-item>
				<u-tabbar-item text="我的任务"></u-tabbar-item>
				<u-tabbar-item text="个人中心"></u-tabbar-item>
			</u-tabbar>
	</view>

调用@change="name => value = name"为你配置的value值

使用<u-tabbar-item text="首页" @click="clicktabbar">事件进行点击匹配跳转

相关推荐
星光一影16 小时前
原生社交app/工会/家族/语音房/直播社交/付费解锁聊天/广场好友圈子/一对一聊天交友
mysql·uni-app·php·html5·交友
anyup16 小时前
🔥牛逼!3分钟生成 5 套主题,还能一键切换暗黑模式!
前端·前端框架·uni-app
2501_9159184118 小时前
iOS 手机抓包软件怎么选?HTTPS 调试、TCP 数据流分析与多工具组合的完整实践
android·ios·智能手机·小程序·https·uni-app·iphone
游戏开发爱好者819 小时前
iOS 应用上架的工程实践复盘,从构建交付到审核通过的全流程拆解
android·ios·小程序·https·uni-app·iphone·webview
00后程序员张19 小时前
iOS App 如何上架,从准备到发布的完整流程方法论
android·macos·ios·小程序·uni-app·cocoa·iphone
Json____19 小时前
uni-app-数码购物商城h5手机端-前端静态网页
前端·uni-app·商城
wx_xsooop19 小时前
iOS 上架4.3a 被拒【uniapp专讲】
flutter·ios·uni-app·uniapp
脾气有点小暴2 天前
uniapp滚动容器冲突
uni-app
鱼樱前端2 天前
uni-app开发app之前提须知(IOS/安卓)
前端·uni-app
二狗mao2 天前
Uniapp使用websocket进行ai回答的流式输出
websocket·网络协议·uni-app