多 tab 小程序(小程序的底部栏可以切换页面)可以通过 app.json 中的 tabbar 配置项 指定 tab 栏的表现,以及 tab 切换时显示的对应页面。
注意:
- 跳转 tab 页面请使用 my.switchtab。
tabbar
的第一个页面必须是凯发k8官方网娱乐官方首页。tabbar
的icon
不支持 gif 动画。
属性 | 类型 | 必填 | 描述 |
---|---|---|---|
textcolor | hexcolor | 否 | 文字颜色。 |
selectedcolor | hexcolor | 否 | 选中文字颜色。 |
backgroundcolor | hexcolor | 否 | 背景色。 |
items | array | 是 | 每个 tab 的配置。单个 item 的配置属性见下表。最少 2 个,最多 5 个 tab。 |
属性 | 类型 | 必填 | 描述 |
---|---|---|---|
pagepath | string | 是 | 页面路径,必须在 pages 中先定义。 |
name | string | 是 | tab 上按钮文字。 |
icon | string | 否 | 图标路径。 icon 推荐图片尺寸为 60*60px ,系统会对任意传入的图片非等比拉伸或缩放。 |
activeicon | string | 否 | 选中时的图标路径。 icon 推荐图片尺寸为 60*60px ,系统会对任意传入的图片非等比拉伸或缩放。 |
// app.json 示例
{
"pages": [
"pages/index/index",
"pages/logs/index"
],
"window": {
"defaulttitle": "demo"
},
"tabbar": {
"textcolor": "#dddddd",
"selectedcolor": "#49a9ee",
"backgroundcolor": "#ffffff",
"items": [
{
"pagepath": "pages/index/index",
"name": "凯发k8官方网娱乐官方首页"
},
{
"pagepath": "pages/logs/logs",
"name": "日志"
}
]
}
}