首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >【愚公系列】2022年02月 微信小程序-app.json配置属性之tabBar

【愚公系列】2022年02月 微信小程序-app.json配置属性之tabBar

作者头像
愚公搬代码
发布2022-02-22 16:23:50
发布2022-02-22 16:23:50
1K0
举报
文章被收录于专栏:历史专栏历史专栏

文章目录

一、app.json配置属性之tabBar

如果小程序是一个多 tab 应用(客户端窗口的底部或顶部有 tab 栏可以切换页面),可以通过 tabBar 配置项指定 tab 栏的表现,以及 tab 切换时显示的对应页面。

属性

类型

必填

默认值

描述

最低版本

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

custom

boolean

false

自定义 tabBar,见详情

2.5.0

二、 list

list 是tabBar下一个属性,功能主要是导航栏列表

list的属性有:

属性

类型

必填

说明

pagePath

string

页面路径,必须在 pages 中先定义

text

string

tab 上按钮文字

iconPath

string

图片路径,icon 大小限制为 40kb,建议尺寸为 81px * 81px,不支持网络图片。当 position 为 top 时,不显示 icon。

selectedIconPath

string

选中时的图片路径,icon 大小限制为 40kb,建议尺寸为 81px * 81px,不支持网络图片。当 position 为 top 时,不显示 icon。

三、tabBar配置案例

代码语言:javascript
复制
"tabBar": {
  "list": [
    {
      "pagePath": "pages/index/index",
      "text": "首页"
    },
    {
      "pagePath": "pages/getOpenId/index",
      "text": "看资讯"
    },
    {
      "pagePath": "pages/getMiniProgramCode/index",
      "text": "我的"
    }
  ],
  "backgroundColor": "#fff",
  "color": "#000",
  "selectedColor": "#0286f1"
},
  1. backgroundColor
  2. selectedIconPath
  3. selectedColor
  4. borderStyle
  5. iconPath
  6. color
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2022/02/21 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 文章目录
  • 一、app.json配置属性之tabBar
  • 二、 list
  • 三、tabBar配置案例
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档