midButton实现tabbar中间图标突出

!!不支持wx小程序,需要自定义tabbar(指路官方文档)https://developers.weixin.qq.com/miniprogram/dev/framework/ability/custom-tabbar.html

1.配置pages.json

"tabBar": {
		"custom": true, // 启用自定义tabBar -------------1
		"color": "#7A7E83",
		"selectedColor": "#007afe",
		"borderStyle": "black",
		"backgroundColor": "#ffffff",
		"list": [{
				"iconPath": "static/tabbar/home1.png",
				"selectedIconPath": "static/tabbar/home2.png",
				"pagePath": "pages/home/home",
				"text": "首页"
			},
			{
				"iconPath": "static/tabbar/yuy1.png",
				"selectedIconPath": "static/tabbar/yuy2.png",
				"pagePath": "pages/reservation/index",
				"text": "预约"
			},
			{
				"iconPath": "static/tabbar/dl1.png",
				"selectedIconPath": "static/tabbar/dl2.png",
				"pagePath": "pages/guide/index",
				"text": "导览"
			},
			{
				"iconPath": "static/tabbar/my1.png",
				"selectedIconPath": "static/tabbar/my2.png",
				"pagePath": "pages/mine/index",
				"text": "我的"
			},
		],
		"midButton": {-------------------------------------2
			"width": "60px",
			"height": "60px",
			"iconWidth": "50px",
			"iconPath": "/static/tabBar/code.png"
		}
	},

 

2.此时不支持点击

需要在app.vue配置,跳转到指定页面

<script>
export default {
  onLaunch: function() {
        uni.onTabBarMidButtonTap(() => {
          uni.navigateTo({
            url: '/pages/code/code',
          });
        })
      },
};
</script>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值