微信小程序--配置(一)

小程序全局配置 app.json app.json微信文档

项目目录
├── app.js                      小程序逻辑
├── app.json                  小程序公共配置
├── app.wxss                 小程序公共样式表
├── static                       静态文件目录
│   └── image
├── pages 
│   │── index
│   │   ├── index.wxml  页面结构
│   │   ├── index.js  页面逻辑
│   │   ├── index.json 页面配置
│   │   └── index.wxss 页面样式表
│   └── logs
│       ├── logs.wxml
│       ├── logs.js
│       ├── logs.json
│       └── logs.wxss
│
└── utils
{
  "pages": [//页面路径列表 指定小程序由哪些页面组成
    "pages/index/index",
    "pages/logs/logs"
  ],
  "window": { //全局的默认窗口表现 用于设置小程序的状态栏、导航条、标题、窗口背景色。
    "navigationBarBackgroundColor": "#ff00ff", //导航栏背景颜色  HexColor
    "navigationBarTextStyle": "white",  //导航栏标题颜色,仅支持 black / white 
    "navigationBarTitleText": "导航栏标题", //导航栏标题文字内容
    "backgroundTextStyle": "light", //下拉 loading 的样式,仅支持 dark / light   
    "backgroundColor": "#ff7545",//窗口的背景色
  },
  "tabBar":{//底部 tab 栏的表现
    "color":"#ff7545", //tab 上的文字默认颜色,仅支持十六进制颜色
    "selectedColor":"#8e1414",//tab 上的文字选中时的颜色,仅支持十六进制颜色
    "backgroundColor":"#eddddd",//tab 的背景色,仅支持十六进制颜色
    "borderStyle":"black",//tabbar 上边框的颜色, 仅支持 black / white
    "position":"bottom",//tabBar 的位置,仅支持 bottom / top
    "list": [//tab 的列表,最少 2 个、最多 5 个 tab    
      {
        "pagePath": "pages/index/index", //页面路径,必须在 pages 中先定义
        "selectedIconPath": "image/icon1.png",//图片路径,icon 大小限制为 40kb,建议尺寸为 81px * 81px,不支持网络图片。当 position 为 top 时,不显示 icon。
        "iconPath": "image/icon1-01.png",//图片路径,icon 大小限制为 40kb,建议尺寸为 81px * 81px,不支持网络图片。当 position 为 top 时,不显示 icon。
        "text": "首页"//tab 上按钮文字
      },
      {
        "pagePath": "pages/logs/logs",
        "selectedIconPath": "image/icon3.png",
        "iconPath": "image/icon3-01.png",
        "text": "日志"
      }
    ]

  },
  "style": "v2",//指定使用升级后的weui样式 app.json 中配置 "style": "v2"可表明启用新版的组件样式。
  "sitemapLocation": "sitemap.json" //指明 theme.json 的位置,darkmode为true为必填
}

小程序页面配置 *.json *.json微信文档

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

{
 "navigationBarBackgroundColor":#000000"",//导航栏背景颜色,如 #000000
 "navigationBarTextStyle":"white",//导航栏标题颜色,仅支持 black / white   
 "navigationBarTitleText": "导航栏标题文字内容",//导航栏标题文字内容
 "backgroundColor":"#ffffff",//窗口的背景色
 "backgroundTextStyle":"dark ",//下拉 loading 的样式,仅支持 dark / light    
 "usingComponents": {} //页面自定义组件配置

}

你可能感兴趣的:(微信小程序--配置(一))