-
全局配置文件及常用配置项
小程序根目录下的app.json文件是小程序的全局配置文件.常用配置项如下:
-
pages
记录当前小程序所有页面的存放路径
-
window
全局设置小程序窗口的外观
常用的配置项:
属性名 类型 默认值 说明 navigationBarTitleText String 字符串 导航栏标题文字内容 navigationBarBackgroundColor HexColor #000000 导航栏背景颜色 navigationBarTextStyle String white 导航栏标题颜色,只支持black/white backgroundColor HexColor #ffffff 窗口的背景色 backgroundTextStyle String dark 下拉loading的样式,只支持dark/light enablePullDownRefresh Boolean false 是否全局开启下拉刷新 onReachBottomDistance Number 50 页面上拉触底事件触发时距页面底部距离,单位为px -
tabBar
设置小程序底部的tabBar效果
用于实现多页面的快速切换,分为底部tabBar和顶部tabBar
注意:
- tabBar中只能配置最少2个,最多5个tab页签
- 当渲染顶部tabBar时,不显示icon,只显示文本
组成部分:
- backgroundColor:tarBar背景色
- selectedconPath:选中的图片路径
- borderStyle:tabBar上边框的yanse
- iconPath:未选中的图片路径
- selectedColor:tab上的文字选中的颜色
- color:tab上文字的默认(未选中)颜色
节点配置项:
属性 类型 必填 默认值 描述 position String 否 bottom tarBar的位置,只支持bottom/top borderStyle String 否 black tabBar上边框的颜色,只支持black/white color HexColor 否 tab上文字的默认(未选中)颜色 selectedColor HexColor 否 tab上的文字选中时的颜色 backgroundColor HexColor 否 tabBer的背景色 list Array 是 tab页签的列表,最少2个,最多5个tab 每个tab项的配置选择
属性 类型 必填 描述 pagePath Srting 是 页面路径,页面必须在pages中预先定义 text Srting 是 tab上显示的文字 iconPath Srting 否 未选中的图标路径;当postion为top时,不显示icon selectedIconPath Srting 否 选中时的图标路径;当postion为top时,不显示icon -
style
是否启用新版的组件样式
-