uniapp的midButton的使用(是否支持小程序)?

简介: uniapp的midButton的使用(是否支持小程序)?

一、使用

项目里面要求App中间按钮凸起,点击可以跳转,在官网上看到tabbar的配置,可以用midButton来实现;我们目前这个项目是要求多端,性能要求不是太高,所以就用的uniapp

1.pages.json中的配置

"tabBar": {
    "color": "#000000",
    "selectedColor": "#f00",
    "backgroundColor": "#fff",
    "midButton": {
      "iconPath": "./static/weixin/tabbar/mine.png",
      "iconWidth": "40px",
      "height": "75px",
      "text": "我的賬戶"
    },
    "list": [
      // 小程序tabbar
      {
        "pagePath": "pages/wexin/coupons/coupons",
        "iconPath": "./static/weixin/tabbar/coupons.png",
        "selectedIconPath": "./static/weixin/tabbar/selectedCoupons.png",
        "text": "電子優惠券"
      }, {
        "pagePath": "pages/wexin/printing/printing",
        "iconPath": "./static/weixin/tabbar/printing.png",
        "selectedIconPath": "./static/weixin/tabbar/selectedPrinting.png",
        "text": "電子印花"
      }, {
        "pagePath": "pages/wexin/discount/discount",
        "iconPath": "./static/weixin/tabbar/discount.png",
        "selectedIconPath": "./static/weixin/tabbar/selectedDiscount.png",
        "text": "優惠獎賞"
      }, {
        "pagePath": "pages/wexin/favorite/favorite",
        "iconPath": "./static/weixin/tabbar/love.png",
        "selectedIconPath": "./static/weixin/tabbar/selectedLove.png",
        "text": "我的最愛"
      }
    ]
  }

midButton 属性说明

image.png

2. midButton没有pagePath,需监听点击事件,官网上面有监听点击midButton的API:uni.onTabBarMidButtonTap

3.我的是在APP.vue里面调用,打开一个页面;

  onShow: function() {
    uni.onTabBarMidButtonTap(() => {
      uni.navigateTo({
        url: "/pages/tabBar/codeDetail/codeDetail",
      })
    })
  },

二、midButton支持小程序吗?

我在官网上找了好久,没有具体看到支持与否,但是在微信小程序上面一直没有效果,在网上查阅了一番,得到了结果:midButton不支持小程序!!!

20210527153548522.png

只是比较浅显的用法,欢迎路过的大佬留言指点。

相关文章
|
11天前
|
JavaScript Java 测试技术
基于SpringBoot+Vue+uniapp的小程序疫苗预约网站系统的详细设计和实现(源码+lw+部署文档+讲解等)
基于SpringBoot+Vue+uniapp的小程序疫苗预约网站系统的详细设计和实现(源码+lw+部署文档+讲解等)
|
6天前
|
JavaScript Java 测试技术
基于SpringBoot+Vue+uniapp的智慧农业小程序的详细设计和实现(源码+lw+部署文档+讲解等)
基于SpringBoot+Vue+uniapp的智慧农业小程序的详细设计和实现(源码+lw+部署文档+讲解等)
20 6
|
6天前
|
JavaScript Java 测试技术
基于SpringBoot+Vue+uniapp的在线答题微信小程序的详细设计和实现(源码+lw+部署文档+讲解等)
基于SpringBoot+Vue+uniapp的在线答题微信小程序的详细设计和实现(源码+lw+部署文档+讲解等)
20 3
|
6天前
|
小程序 定位技术
uniapp微信小程序地图全屏显示配送范围
uniapp微信小程序地图全屏显示配送范围
13 1
|
10天前
|
JavaScript Java 测试技术
基于SpringBoot+Vue+uniapp的校园导航微信小程序的详细设计和实现(源码+lw+部署文档+讲解等)
基于SpringBoot+Vue+uniapp的校园导航微信小程序的详细设计和实现(源码+lw+部署文档+讲解等)
24 4
|
3天前
|
JavaScript Java 测试技术
基于SpringBoot+Vue+uniapp的宠物咖小程序的详细设计和实现(源码+lw+部署文档+讲解等)
基于SpringBoot+Vue+uniapp的宠物咖小程序的详细设计和实现(源码+lw+部署文档+讲解等)
3 0
|
3天前
|
JSON 缓存 小程序
技术笔记:uniapp微信小程序支付
技术笔记:uniapp微信小程序支付
|
11天前
|
JavaScript Java 测试技术
基于SpringBoot+Vue+uniapp的食堂校园预约就餐小程序的详细设计和实现(源码+lw+部署文档+讲解等)
基于SpringBoot+Vue+uniapp的食堂校园预约就餐小程序的详细设计和实现(源码+lw+部署文档+讲解等)
|
11天前
|
JavaScript Java 测试技术
基于SpringBoot+Vue+uniapp的教育培训微信小程序的详细设计和实现(源码+lw+部署文档+讲解等)
基于SpringBoot+Vue+uniapp的教育培训微信小程序的详细设计和实现(源码+lw+部署文档+讲解等)
|
11天前
|
JavaScript Java 测试技术
基于SpringBoot+Vue+uniapp的速达物流信息查询微信小程序的详细设计和实现(源码+lw+部署文档+讲解等)
基于SpringBoot+Vue+uniapp的速达物流信息查询微信小程序的详细设计和实现(源码+lw+部署文档+讲解等)