1.pages.json中将tabBar下面全部注释掉

uniapp实现自定义tabbar【直用版】插图

2.在common文件夹下面建一个tabbar文件夹,里面放个tabbar.vue(位置,名称自己随意)

tabbar.vue:(直接复制)


	
					
				
				
					
					
				
				<!--  {{item.text}} 		 -->
		
	





   .tabbar{
	   /* border-top:1rpx solid #c5c4c5; */
	   background-color:#FFFF ;
	   z-index: 999;
	   position: fixed;
	   left: 0;
	   bottom: 0;
	   width: 100%;
	   height: 120rpx;
	   display: flex;
	   justify-content: space-around;
	   align-items: center;
   }
   .tab{
	   display: flex;
	   flex-direction: column;
	   justify-content: center;
	   align-items: center;
   }
   image{
	   width: 50rpx;
	   height: 50rpx;
   }
   .addIco{
	   width: 50px;
	   height: 50px;
   }

3.在需要用到tabbar的位置(index,myinfo)中引入

index.vue:

 下面代码直接放当前页面底部就行,注意传递了一个’index‘的值,这个值与tabbar中的pagePath是对应的,以此来判断该跳转哪个页面


	

myinfo.vue


	

 现在可以用了

本站无任何商业行为
个人在线分享 » uniapp实现自定义tabbar【直用版】
E-->