1,全局配置app.json相关配置属性

1.1,pages: 小程序所有页面路径配置

  1. - **用于指定小程序有哪些页面组成,每一项都对应一个页面的路径信息**
  2. - **小程序中的所有页面都必须在pages中进行注册**

1.2,window:全局的默认窗口展示

  1. - **指定窗口如何给用户展示**
  2. - **navigationBarBackgroundColor: 头部导航背景色,只接受16禁止颜色值**
  3. - **navigationBarTextStyle: 更改状态栏的颜色值(时间,电量图标栏),只支持黑色和白色单词**
  4. - **navigationBarTitleText: 头部导航标题**
  5. - **backgroundColor: 下拉时留白处的默认颜色**
  6. - **enablePullDownRefresh: true/false是否允许页面下拉弹簧留白**

image.png

  1. - **backgroundTextStyle: 设置上图下拉后三个点的样式,值为:darklight**

1.3,tabBar:底部导航配置

  1. - **lists:导航配置,类型为数组,至少要有两个导航**
  2. - **pagePath: 要跳转的页面路径,路径必须是pages中存在的**
  3. - **text: 显示的文本**
  4. - **iconPath: 默认显示的icon路径**
  5. - **selectedIconPath: 选中时的icon路径**
  6. - **selectedColor: 选中时文字颜色**
  1. "tabBar": {
  2. "selectedColor": "#ff0000"
  3. "lists":[
  4. {
  5. "pagePath": "pages/home/home",
  6. "text": "首页",
  7. "iconPath": "默认icon路径",
  8. "selectedIconPath": "选中时的icon路径"
  9. },
  10. {
  11. "pagePath": "pages/home/home",
  12. "text": "首页",
  13. "iconPath": "默认icon路径",
  14. "selectedIconPath": "选中时的icon路径"
  15. }
  16. ]
  17. }

2, 页面配置,页面层级下的json文件配置

  • 页面配置会覆盖全局配置
  • navigationBarTitleText: 设置页面标题
  • navigationBarBackgroundColor: 设置页面头部导航背景色
  • enablePullDownRefresh: true/false, 设置是否开启下拉刷新
    1. {
    2. "navigationBarTitleText": "关于",
    3. "navigationBarBackgroundColor": "#ff0000",
    4. "enablePullDownRefresh": "false"
    5. }