单页面配置
原创2026/3/5大约 1 分钟

app.json 中的部分配置,也支持对单个页面进行配置
可以在页面对应的 文件.json 文件来对本页面的表现进行配置
配置项
| 属性 | 类型 | 默认值 | 描述 |
|---|---|---|---|
| navigationBarBackgroundColor | HexColor | #000000 | 导航栏背景颜色,如 #000000 |
| navigationBarTextStyle | string | white | 导航栏标题颜色,仅支持 black / white |
| navigationBarTitleText | string | 导航栏标题文字内容 | |
| backgroundColor | HexColor | #ffffff | 窗口的背景色(开启下拉菜单可以观察) |
| backgroundTextStyle | string | dark | 下拉 loading 的样式,仅支持 dark / light |
| enablePullDownRefresh | boolean | false | 是否开启当前页面下拉刷新 |
| onReachBottomDistance | number | 50 | 页面上拉触底事件触发时距页面底部距离,单位为 px。 |
| style | string | default | 启用新版的组件样式 |
| ... | ... | ... | ... |
注意
虽然配置与 app.json 基本一致,但是注意,不再需要添加 window 作为父级
单页面里的.json配置会覆盖掉app.json的配置
{
"usingComponents": {},
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black",
"navigationBarTitleText": "第二个页面",
"backgroundColor": "#ffffff",
"backgroundTextStyle": "light",
"enablePullDownRefresh": true,
"onReachBottomDistance": 50,
"style": "v2"
}自定义 window 和 tabBar
相关信息
- 自定义 window
"navigationStyle": "custom",使用官网自带的头部,样式单一,结构固定,不适合复杂业务的处理,因此可以选择当前页面自定义头部布局
- 自定义 tarBar
"tabBar": {
"custom":true,
……
}所有 tab 页的 json 里需声明 usingComponents 项,也可以在 app.json 全局开启 custom。
至此,本章节的学习就到此结束了,如有疑惑,可对接技术客服进行相关咨询。