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">事件进行点击匹配跳转

相关推荐
粉末的沉淀10 小时前
uniapp:带参数回到上一页
uni-app
华玥作者14 小时前
从“碎片化”到“资产化”:Vue3 + UniApp 组件库的进化论
ui·uni-app·vue·组件库
Crystal32815 小时前
App wgt 热更新 — 开发笔记(uniapp)
前端·uni-app·app
大阳光男孩16 小时前
【UniApp小程序开发】解决无法使用Vue自定义指令的完美替代方案:权限组件封装
前端·vue.js·uni-app
2501_9159184116 小时前
Linux 上生成 AppStoreInfo.plist,App Store 上架 iOS
android·ios·小程序·https·uni-app·iphone·webview
只要微微辣16 小时前
Uniapp 微信小程序 Canvas画框标注:拖拽缩放全攻略
前端·微信小程序·uni-app·canvas·canva可画
我命由我1234516 小时前
Dart - 数字类型、布尔类型、列表类型
android·开发语言·flutter·ios·uni-app·android jetpack·移动端
一朵盆栽17 小时前
uni-app用Windows系统开发iOS端
ios·uni-app·cocoa
anyup1 天前
uni-app X 全屏引导页组件,一套支持 App、H5、小程序多端引导
前端·架构·uni-app
织_网3 天前
UniApp 快速集成个推推送(UniPush2.0)完整实战教程
uni-app