微信小程序 json 配置

页面级别配置 优先级 高于 全局配置。

具体配置项:https://developers.weixin.qq.com/miniprogram/dev/framework/config.html

全局配置 app.json 1.pages:配置的第一个页面是 程序默认展示的页面(程序入口页)。2.window:

  a. navigationBarBackgroundColor : 导航栏背景颜色.
  b. navigationBarTextStyle : 导航栏标题颜色,仅支持 black/white.
  c. navigationBarTitleText : 导航栏标题文字内容.
  d. enablePullDownRefresh : 是否开启下拉刷新,详见页面相关事件处理函数.
  e. backgroundTextStyle : 下拉 loading 的样式,仅支持 dark/light.
  f. backgroundColor : 窗口的背景色.
3.
debug:可以在开发者工具中开启 debug 模式,在开发者工具的控制台面板,调试信息以 info 的形式给出,其信息有Page的注册页面路由数据更新事件触发 。
4.tabBar:如果小程序是一个多 tab 应用(客户端窗口的底部或顶部有 tab 栏可以切换页面),可以通过 tabBar 配置项指定 tab 栏的表现,以及 tab 切换时显示的对应页面。小项目常用。
注意:
    • 1. 当设置 position 为 top 时,将不会显示 icon
    •  

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

  a. color : tab 上的文字默认颜色
  b. selectedColor : tab 上的文字选中时的颜色
  c. selectedColor :tab 的背景色
  d. borderStyle :tabbar上边框的颜色, 仅支持 black/white
  e. list :tab 的列表,详见 list 属性说明,最少2个、最多5个 tab. 其中 list 接受一个数组,数组中的每个项都是一个对象
    1. pagePath : 页面路径,必须在 pages 中先定义
    2. text : tab 上按钮文字
    3. iconPath : 图片路径,icon 大小限制为40kb,建议尺寸为 81px * 81px,当 postion 为 top 时,此参数无效,不支持网络图片
    4. selectedIconPath : 选中时的图片路径,icon 大小限制为40kb,建议尺寸为 81px * 81px ,当 postion 为 top 时,此参数无效
  f. position : 可选值 bottom、top
5.
networkTimeout : 可以设置各种网络请求的超时时间。设置超时时长。
  a. request : wx.request的超时时间,单位毫秒,默认为:60000
  b. connectSocket: wx.connectSocket的超时时间,单位毫秒,默认为:60000
  c. uploadFile :wx.uploadFile的超时时间,单位毫秒,默认为:60000
  e. downloadFile : wx.downloadFile的超时时间,单位毫秒,默认为:60000

页面级别配置:
1. disableScroll : 设置为 true 则页面整体不能上下滚动;只在 page.json 中有效,无法在 app.json 中设置该项
2. onReachBottomDistance : 页面上拉触底事件触发时距页面底部距离,单位为px

猜你喜欢

转载自www.cnblogs.com/zhangyajun/p/9164703.html