小程序app.json配置

{
  "pages":[
    "pages/index/index",
    "pages/logs/logs"
  ],
  "window":{
    "backgroundTextStyle":"light",
    "navigationBarBackgroundColor": "#fff",
    "navigationBarTitleText": "WeChat",
    "navigationBarTextStyle":"black"
  }
}

比较全点的配置

{
  "pages": [
    "pages/index/index",
    "pages/logs/index"
  ],
  "window": {
    "navigationBarTitleText": "Demo"
  },
  "tabBar": {
    "list": [{
      "pagePath": "pages/index/index",
      "text": "首页"
    }, {
      "pagePath": "pages/logs/logs",
      "text": "日志"
    }]
  },
  "networkTimeout": {
    "request": 10000,
    "downloadFile": 10000
  },
  "debug": true
}
属性              类型      必填  描述
pages       String Array    是   设置页面路径
window          Object      否   设置默认页面的窗口表现
tabBar          Object      否   设置底部 tab 的表现
networkTimeout  Object      否   设置网络超时时间
debug           Boolean     否   设置是否开启 debug 模式
属性                              类型          默认值     描述
navigationBarBackgroundColor    HexColor    #000000     导航栏背景颜色,如"#000000"
navigationBarTextStyle          String      white       导航栏标题颜色,仅支持 black/white
navigationBarTitleText          String                  导航栏标题文字内容
backgroundColor                 HexColor    #ffffff     窗口的背景色
backgroundTextStyle             String      dark        下拉背景字体、loading 图的样式,仅支持 dark/light
enablePullDownRefresh           Boolean     false       是否开启下拉刷新

tabBar 是一个数组,只能配置最少2个、最多5个 tab,tab 按数组的顺序排序。

属性说明:

属性              类型      必填      默认值     描述
color           HexColor    是               tab 上的文字默认颜色
selectedColor   HexColor    是               tab 上的文字选中时的颜色
backgroundColor HexColor    是               tab 的背景色
borderStyle     String      否       black       tabbar上边框的颜色, 仅支持 black/white
list            Array       是               tab 的列表,最少2个、最多5tab
position        String      否       bottom      可选值 bottom、top

其中 list 接受一个数组,数组中的每个项都是一个对象,其属性值如下:

属性              类型  必填      说明
pagePath        String  是   页面路径,必须在 pages 中先定义
text            String  是   tab 上按钮文字
iconPath        String  是   图片路径,icon 大小限制为40kb,建议尺寸为 81px * 81px
selectedIconPath String 是   选中时的图片路径,icon 大小限制为40kb,建议尺寸为 81px * 81px

networkTimeout
可以设置各种网络请求的超时时间。

属性说明:

属性              类型      必填      说明
request         Number      否   wx.request的超时时间,单位毫秒,默认为:60000
connectSocket   Number      否   wx.connectSocket的超时时间,单位毫秒,默认为:60000
uploadFile      Number      否   wx.uploadFile的超时时间,单位毫秒,默认为:60000
downloadFile    Number      否   wx.downloadFile的超时时间,单位毫秒,默认为:60000

debug
可以在开发者工具中开启 debug 模式,在开发者工具的控制台面板,调试信息以 info 的形式给出,其信息有Page的注册,页面路由,数据更新,事件触发 。 可以帮助开发者快速定位一些常见的问题。

page.json
每一个小程序页面也可以使用.json文件来对本页面的窗口表现进行配置。 页面的配置比app.json全局配置简单得多,只是设置 app.json 中的 window 配置项的内容,页面中配置项会覆盖 app.json 的 window 中相同的配置项。

页面的.json只能设置 window 相关的配置项,以决定本页面的窗口表现,所以无需写 window 这个键,如:

属性                              类型      默认值     描述
navigationBarBackgroundColor    HexColor    #000000 导航栏背景颜色,如"#000000"
navigationBarTextStyle          String      white   导航栏标题颜色,仅支持 black/white
navigationBarTitleText          String              导航栏标题文字内容
backgroundColor                 HexColor    #ffffff 窗口的背景色
backgroundTextStyle             String      dark    下拉背景字体、loading 图的样式,仅支持 dark/light
enablePullDownRefresh           Boolean     false   是否开启下拉刷新,详见页面相关事件处理函数。
disableScroll                   Boolean     false   设置为 true 则页面整体不能上下滚动;只在 page.json 中有效,无法在 app.json 中设置该项
{
  "navigationBarBackgroundColor": "#ffffff",
  "navigationBarTextStyle": "black",
  "navigationBarTitleText": "微信接口功能演示",
  "backgroundColor": "#eeeeee",
  "backgroundTextStyle": "light"
}

专业墙纸贴纸厨房用具装饰出售,本人网店经营

博客对你有用记得访问下哦,增加下访问量,如有需要可以下单购买哦^_^。https://item.taobao.com/item.htm?id=569617707364

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

黄宝康

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值