小程序全局配置
小程序全局配置
全局配置文件即 app.json
布局
- 导航栏区域
- 背景区域
- 页面的主体区域
window 节点常用的配置项
属性名 | 类型 | 默认值 | 说明 |
---|---|---|---|
navigationBarTitleText | String | 字符串 | 导航栏标题文字内容 |
navigationBarBackgroundColor | HexColor | #000000 | 导航栏背景颜色 |
navigationBarTextStyle | String | white | 导航栏标题颜色,仅支持 black/white |
backgroundColor | HexColor | #ffffff | 窗口的背景色 |
backgroundTextStyle | String | dark | 下拉loading的样式,仅支持 dark/light |
enablePullDownRefresh | Booelean | false | 是否全局开启下拉刷新 |
onReachBottomDistance | Number | 50 | 页面下拉触底事件触发时距页面底部的距离,单位为px |
tabBar
用于页面快速切换
tabBar 最少需要配置2个标签页;最多配置5个标签页
顶部tabBar
顶部 tabBar 只有文本,没有图标
底部tabBar
底部 tabBar 上面为图标,下面为文本
基本配置项
属性名 | 类型 | 是否必填 | 默认值 | 说明 |
---|---|---|---|---|
backgroundColor | HexColor | 否 | #000000 | tabBar背景色 |
borderStyle | HexColor | 否 | black | tabBar边框色 |
color | HexColor | 否 | tabBar标签页文 | |
selectedColor | HexColor | 否 | 选中的tabBar标签页文本颜色 | |
position | String | 否 | bottom | tabBar的位置,仅支持 top/bottom |
list | Array | 是 | tabBar标签页列表 |
list 配置项
属性名 | 类型 | 是否必填 | 说明 |
---|---|---|---|
pagePath | String | 是 | 页面路径,页面必须在pages中预先设置 |
text | String | 是 | 标签页文本 |
iconPath | String | 否 | 未选中时的图标 |
selectedIconPath | String | 否 | 未选中时的图标 |
-
感谢你赐予我前进的力量
赞赏者名单
因为你们的支持让我意识到写文章的价值🙏
本文是原创文章,采用 CC BY-NC-ND 4.0 协议,完整转载请注明来自 View Room
评论