uniapp在非tabbar页面中显示tabbar的方法 - 显示底部导航栏

效果

 

前言

最好是自己手写一个view模仿tabbar,兼容性最好
最好是自己手写一个view模仿tabbar,兼容性最好
最好是自己手写一个view模仿tabbar,兼容性最好

本方法用的是uniapp自带的组件“custom-tab-bar”

兼容性不行,安卓app上就看不到,小程序也看不到,这它喵的.... 
https://uniapp.dcloud.io/component/custom-tab-bar.html#custom-tab-bar

平台兼容性 仅 H5 支持,HBuilderX 2.9.9 + 。

步骤

以下是custom-tab-bar组件的使用方法,建议不要用,自己在页面底部手写一个view更好

<template>
	<view>
		<view style="padding: 130rpx; text-align: center;">
			详情页 - 因为不是tabbar成员,所以默认不带tabbar
		</view>
		
		<view class="my-sub-tabbar-wrapper">
			
			<custom-tab-bar direction="horizontal" :show-icon="true" :selected="selectedIndex" @onTabItemTap="tabbarTaped" />
			
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				selectedIndex: 0 // 表示tabbar中下标=0的图标被选中
			}
		},
		methods: {
			tabbarSelected (e) {
				console.log(e);
			},
			tabbarTaped (e) {
				console.log(e);
			}
		},
		onLoad () {
			
		}
	}
</script>

<style>
	.my-sub-tabbar-wrapper {
		position: fixed;
		bottom: 0;
		left: 0;
		width: 100%;
	}
	
	.uni-tabbar__icon {
		height: 20rpx;
		width: 20rpx;
	}
</style>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Rudon滨海渔村

花的越多,赚得越多...

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值