微信小程序 - JSON 配置 - window 配置 - tabBar 配置 --Y.

JSON 配置

配置文档:https://mp.weixin.qq.com/debug/wxadoc/dev/framework/config.html

如:app.json

{
  "pages": [
    "pages/index/index",
    "pages/logs/logs"
  ],
  "window": {
    "navigationBarTitleText": "小程序标题"
  },
  "tabBar": {
    "list": [{
      "pagePath": "pages/index/index",
      "text": "首页"
    }, {
      "pagePath": "pages/logs/logs",
      "text": "Tab栏"
    }]
  },
  "networkTimeout": {
    "request": 10000,
    "downloadFile": 10000
  },
  "debug": true
}

window 配置

用于设置小程序的状态栏、导航条、标题、窗口背景色。

window 配置图示 ![这里写图片描述](https://img-blog.csdn.net/20180810170225737?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MjU3NTM1NA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
window 配置注意事项 !! 注意:页面的.json只能设置 window 相关的配置项,以决定本页面的窗口表现,所以无需写 window 这个关键词。 如:/pages/message/message.json
    {
        "navigationBarBackgroundColor": "#ffffff",
        "navigationBarTextStyle": "black",
        "navigationBarTitleText": "内页标题修改",
        "backgroundColor": "#eeeeee",
        "backgroundTextStyle": "light"
    }

tabBar 配置

如果小程序是一个多 tab 应用(客户端窗口的底部或顶部有 tab 栏可以切换页面),可以通过 tabBar 配置项指定 tab 栏的表现,以及 tab 切换时显示的对应页面。 iconPath String 否 图片路径,icon 大小限制为40kb,建议尺寸为 81px * 81px,当 postion 为 top 时,此参数无效 selectedIconPath String 否 选中时的图片路径,icon 大小限制为40kb,建议尺寸为 81px * 81px ,当 postion 为 top 时,此参数无效
tabBar 配置图示

这里写图片描述

tabBar 配置注意事项
  1. 当设置 position 为 top 时,将不会显示 icon。
  2. tabBar 中的 list 是一个数组,只能配置最少2个、最多5个 tab,tab 按数组的顺序排序。
  3. icon 大小限制为40kb,建议尺寸为 81px * 81px。

猜你喜欢

转载自blog.csdn.net/weixin_42575354/article/details/81566733