tabbar文字和icon混用时,icon不垂直居中
发布于 6 年前 作者 juanguo 13266 次浏览 来自 问答
  • 需求的场景描述(希望解决的问题)

配置如下:

"tabBar": {
      color: '#333',
      selectedColor: '#FF6633',
      borderStyle: "#f8f8f8",
      backgroundColor: '#ffffff',
      "list": [{
        "pagePath": "pages/index/main",
        "text": "首页"
      }, {
        "pagePath": "pages/ucenter/message/main",
        "text": "消息",
      }, {
        "pagePath": "pages/publish/main",
        "iconPath": "static/image/plus.png",
      }, {
        "pagePath": "pages/search/main",
        "text": '发现'
      }, {
        "pagePath": "pages/ucenter/index/main",
        "text": "我"
      }]
    }

需要实现的效果如下:

而小程序的tabbar设置后的效果如下,当text属性没有的时候,iconPath图片不能垂直居中。

  • 希望提供的能力

当tabbar配置 text不存在 而存在 iconPath 的时候,图片能自行垂直居中

1 回复

同问,只有icon,没有文字时,icon不居中。开发者工具上是居中的,ios真机上不居中。

回到顶部