全局配置
window
用于设置小程序的状态栏、导航条、标题、窗口背景色。json
-
navigationBarBackgroundColor HexColor #000000 导航栏背景颜色,如 #000000小程序
-
navigationBarTextStyle String white 导航栏标题颜色,仅支持 black / white微信小程序
-
navigationBarTitleText String 导航栏标题文字内容数组
<p style="color: #f60;">wepy框架里面不能直接在app里面设置,须要在使用的页面里面设置,不然不会显示</p>微信
-
navigationStyle String default 导航栏样式,仅支持如下值:网络
- default 默认样式
- custom 自定义导航栏,只保留右上角胶囊按钮。
-
backgroundColor HexColor #ffffff 窗口的背景色app
<p style="color: #f60;">当咱们在微信小程序`json`中设置`backgroundColor` 时,实际在电脑的模拟器中根本看不到效果。 这是由于 `backgroundColor` 指的窗体背景颜色,而不是页面的背景颜色,即窗体下拉刷新或上拉加载时露出的背景。在电脑的模拟器中是看不到这个动做的,因此会让人误觉得这个配置是无效的。</p>框架
-
backgroundTextStyle String dark 下拉 loading 的样式,仅支持 dark / lightpost
-
backgroundColorTop String #ffffff 顶部窗口的背景色,仅 iOS 支持 微信客户端 6.5.16spa
-
backgroundColorBottom String #ffffff 底部窗口的背景色,仅 iOS 支持 微信客户端 6.5.16
-
enablePullDownRefresh Boolean false 是否开启当前页面的下拉刷新。 详见 Page.onPullDownRefresh
-
onReachBottomDistance Number 50 页面上拉触底事件触发时距页面底部距离,单位为px。 详见 Page.onReachBottom
-
pageOrientation String portrait 屏幕旋转设置,仅支持 auto / portrait 详见 响应显示区域变化 微信客户端 6.7.3
用例:
window: { // 导航栏背景颜色 "navigationBarBackgroundColor": "#FF6666", // 导航栏标题颜色,仅支持 black / white "navigationBarTextStyle": "white", // 航栏样式,仅支持如下值: default, custom 自定义导航栏,只保留右上角胶囊按钮 "navigationStyle": "default", // 窗口的背景色 "backgroundColor": "#e5e5e5", // 下拉 loading 的样式,仅支持 dark / light "backgroundTextStyle": "dark", // 屏幕旋转设置,仅支持 auto / portrait "pageOrientation": "portrait", }
Tabbar
若是小程序是一个多tab
应用(客户端窗口的底部或顶部有 tab 栏能够切换页面),能够经过tabBar
配置项指定tab
栏的表现,以及tab
切换时显示的对应页面。
- color tab上的文字默认颜色,仅支持十六进制颜色
- selectedColor tab上的文字选中时的颜色,仅支持十六进制颜色
- backgroundColor tab的背景色,仅支持十六进制颜色
- borderStyle tabbar上边框的颜色, 仅支持 black / white
- list tab的列表,详见 list 属性说明,最少2个、最多5个 tab
- position tabBar的位置,仅支持 bottom / top
list 接受一个数组,只能配置最少2个、最多5个 tab。tab 按数组的顺序排序,每一个项都是一个对象,其属性值以下:
- pagePath 页面路径,必须在 pages 中先定义
- text tab上按钮文字
- iconPath 图片路径,icon 大小限制为40kb,建议尺寸为 81px * 81px,不支持网络图片。当 postion 为 top 时,不显示 icon。
- selectedIconPath 选中时的图片路径,icon 大小限制为40kb,建议尺寸为 81px * 81px,不支持网络图片。当 postion 为 top 时,不显示 icon。
用例:
tabBar: { color: '#666666', selectedColor: '#ff6600', position: 'bottom', backgroundColor: '#fff', borderStyle: 'black', list: [ { pagePath: 'pages/home/index', text: '首页', iconPath: 'assets/img/icon-1.png', selectedIconPath: 'assets/img/icon-1-selected.png' }, { pagePath: 'pages/search/index', text: '搜索', iconPath: 'assets/img/icon-2.png', selectedIconPath: 'assets/img/icon-2-selected.png' }, { pagePath: 'pages/sell/index', text: '排行榜', iconPath: 'assets/img/icon-3.png', selectedIconPath: 'assets/img/icon-3-selected.png' }, { pagePath: 'pages/spike/index', text: '抢购', iconPath: 'assets/img/icon-2.png', selectedIconPath: 'assets/img/icon-2-selected.png' }, { pagePath: 'pages/profile/index', text: '个人', iconPath: 'assets/img/icon-5.png', selectedIconPath: 'assets/img/icon-5-selected.png' } ] }