uniapp如何实现tabbar中间加突出效果的图标(App)

注意点:只在真机上点击才有效果,浏览器会报错,运行到手机模拟器上操作。

效果图

在pages.json中配置tabbar数组(list)的下面配置以下代码

	"midButton": {
			"width": "80px",
			"height": "60px",
			"iconPath": "static/tianjia.png",  tabbar中间的图标
			"iconWidth": "50px"
		}

如果要实现点击代码如下

在根组件(App.vue)中 onLaunch声明周期中使用内置的API   uni.onTabBarMidButtonTap 点击中间图标就会触发的API(API只在根组件生效)
示例代码如下
onLaunch: function() {
			uni.onTabBarMidButtonTap(() => {
      	console.log('点击了')
				
			})
		},

如果要实现点击弹层代码如下

你可能感兴趣的:(javascript,前端,vue.js)