开发 .json 文件

小程序页面可以使用.json文件来对本页面的窗口表现进行配置。

页面的配置只能设置 app.json 中部分 window 配置项的内容,页面中配置项会覆盖 app.json 的 window 中相同的配置项。

配置示例

代码示例

  1. { "navigationBarBackgroundColor": "#ffffff", "navigationBarTextStyle": "black", "navigationBarTitleText": "智能小程序接口功能演示", "backgroundColor": "#eeeeee", "backgroundTextStyle": "light"}

页面配置项列表

说明:

  • AndroidiOS从基础库版本 2.10.34 开始支持, 但子页面配置支持情况Android基础库版本2.10.34开始支持,iOS基础库版本 3.0.39开始支持, 做低版本兼容时,通过 swan.getSystemInfo 或者 swan.getSystemInfoSync 获取百度 App版本号进行兼容判断,具体见下表;
  • canIUse或者SWAN基础库版本进行兼容判断。 navigationStyle配置 适配提示 swan.getSystemInfo 或者 swan.getSystemInfoSync 获取。