1、页面配置

每一个小程序页面也可以使用 .json 文件来对本页面的窗口表现进行配置。页面中配置项在当前页面会覆盖 app.json 的 window 中相同的配置项。

参考微信开发文档:https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/page.html

配置项

属性类型默认值描述最低版本
navigationBarBackgroundColorHexColor#000000导航栏背景颜色,如 #000000 
navigationBarTextStylestringwhite导航栏标题颜色,仅支持 black / white 
navigationBarTitleTextstring 导航栏标题文字内容 
navigationStylestringdefault导航栏样式,仅支持以下值:
default 默认样式
custom 自定义导航栏,只保留右上角胶囊按钮
微信客户端 7.0.0
backgroundColorHexColor#ffffff窗口的背景色 
backgroundTextStylestringdark下拉 loading 的样式,仅支持 dark / light 
backgroundColorTopstring#ffffff顶部窗口的背景色,仅 iOS 支持微信客户端 6.5.16
backgroundColorBottomstring#ffffff底部窗口的背景色,仅 iOS 支持微信客户端 6.5.16
enablePullDownRefreshbooleanfalse是否开启当前页面下拉刷新。
详见 Page.onPullDownRefresh
 
onReachBottomDistancenumber50页面上拉触底事件触发时距页面底部距离,单位为px。
详见 Page.onReachBottom
 
pageOrientationstringportrait屏幕旋转设置,支持 autoportrait / landscape 
详见 响应显示区域变化
2.4.0 (auto) / 2.5.0(landscape)
disableScrollbooleanfalse设置为 true 则页面整体不能上下滚动。
只在页面配置中有效,无法在 app.json 中设置
 
disableSwipeBackbooleanfalse禁止页面右滑手势返回微信客户端 7.0.0
usingComponentsObject页面自定义组件配置1.6.3

 

示例:增加"navigationBarBackgroundColor": "#fff"

{

"navigationBarTitleText": "查看启动日志",

"usingComponents": {},

"navigationBarBackgroundColor": "#fff"

}

 

Logo

北京人形旗下天工造物具身智能开源社区,聚焦具身天工与慧思开物两大平台

更多推荐