【微信小程序】tabBar全局配置

一、tabBar的组成成分

属性 类型 必填 默认值 描述
color HexColor tab 上的文字默认颜色,仅支持十六进制颜色
selectedColor HexColor tab 上的文字选中时的颜色,仅支持十六进制颜色
backgroundColor HexColor tab 的背景色,仅支持十六进制颜色
borderStyle string black tabbar 上边框的颜色, 仅支持 black / white
list Array tab 的列表,详见 list 属性说明,最少 2 个、最多 5 个 tab
position string bottom tabBar 的位置,仅支持 bottom / top

二、list属性

属性 类型 必填 说明
pagePath string 页面路径,必须在 pages 中先定义
text string tab 上按钮文字
iconPath string 图片路径,icon 大小限制为 40kb,建议尺寸为 81px * 81px,不支持网络图片。 positiontop 时,不显示 icon。
selectedIconPath string 选中时的图片路径,icon 大小限制为 40kb,建议尺寸为 81px * 81px,不支持网络图片。 positiontop 时,不显示 icon。

更多信息:全局配置 | 微信开放文档

三、示例

复制代码
"tabBar": {
      "selectedColor": "#f3514f",
      "color": "#666",
      "backgroundColor": "#efefef",
      "borderStyle":"black",
      "position":"bottom",
      "list": [
          {
              "text": "首页",
              "pagePath": "pages/index/index",
              "iconPath": "/image/first_page.png",
              "selectedIconPath": "/image/active_fp.png"
          },
          {
            "text": "分类",
            "pagePath": "pages/classify/classify",
            "iconPath": "/image/classify.png",
            "selectedIconPath": "/image/active_classify.png"
        },
        {
            "text": "购物车",
            "pagePath": "pages/car/car",
            "iconPath": "/image/buy_car.png",
            "selectedIconPath": "/image/active_car.png"
        },
        {
            "text": "我的",
            "pagePath": "pages/me/me",
            "iconPath": "/image/me.png",
            "selectedIconPath": "/image/active_me.png"
        }
      ]
  },
相关推荐
云霄IT19 小时前
新版电脑微信4.1.x.x小程序逆向之——寻找小程序存放位置目录和__APP__.wxapkg
java·微信·小程序
wmsj057819 小时前
微信小程序上的图片怎么批量下载?附工具教程
小程序
鸭鸭梨吖19 小时前
微信小程序输入框---模糊搜索
微信小程序·小程序·notepad++
2501_9151063220 小时前
iOS 应用加固与苹果软件混淆指南,如何防止 IPA 被反编译与二次打包?
android·ios·小程序·https·uni-app·iphone·webview
Stringzhua21 小时前
微信小程序快速入门【02】
微信小程序·小程序
赵庆明老师1 天前
Uniapp微信小程序开发:全局变量的使用
微信小程序·小程序·uni-app
2501_915921431 天前
iOS 应用加固与苹果软件混淆全解析 IPA 文件防反编译、混淆加密与无源码加固策略
android·macos·ios·小程序·uni-app·cocoa·iphone
2401_885405511 天前
定位守护童年,科技构筑安全屏障
科技·物联网·安全·小程序·宠物·web app·智能手表
lvchaoq1 天前
记录小程序真机bug,而模拟器无法复现
小程序·bug
2501_916007471 天前
iOS 代上架实战指南,从账号管理到使用 开心上架 上传IPA的完整流程
android·macos·ios·小程序·uni-app·cocoa·iphone