【小程序】配置

全局配置

{
  "entryPagePath": "pages/index/index",        // 小程序默认启动首页【不填,将默认为 pages 列表的第一项】
  "pages":[                                    // 页面文件路径地址列表
    "pages/index/index",                       // 不支持带页面路径参数
    "pages/logs/logs"
  ],
  "window":{                                   // 全局的默认窗口表现
    "backgroundTextStyle": "light",            // 下拉 loading 的样式,仅支持 dark / light
    "navigationBarBackgroundColor": "#000000", // 导航栏背景颜色
    "navigationBarTitleText": "Weixin",        // 导航栏标题文字内容
    "navigationBarTextStyle": "black",         // 导航栏标题颜色,仅支持 black / white
    "navigationStyle": "default",              // 导航栏样式,仅支持 default / custom
    "backgroundColor": "#ffffff",              // 窗口的背景色
    "backgroundColorTop": "#ffffff",           // 顶部窗口的背景色
    "backgroundColorBottom": "#ffffff",        // 底部窗口的背景色
    "enablePullDownRefresh": false,            // 是否开启全局的下拉刷新
    "onReachBottomDistance": 50,               // 页面上拉触底事件触发时距页面底部距离,单位为 px。
    "pageOrientation": "portrait",             // 屏幕旋转设置,支持 auto / portrait / landscape
  },
  "tabBar":{                                   // 底部 tab 栏的表现
    "color": "#ffffff",                        // tab 上的文字默认颜色,仅支持十六进制颜色
    "selectedColor": "#07c160",                // tab 上的文字选中时的颜色,仅支持十六进制颜色
    "backgroundColor": "#ffffff",              // tab 的背景色,仅支持十六进制颜色
    "borderStyle": "#eaeaea",                  // tabbar 上边框的颜色, 仅支持 black / white
    "list": [                                  // tab 的列表
         {
            "pagePath": "pages/index/index",       // 页面路径,必须在 pages 中先定义
            "text": "首页",                        // tab 上按钮文字
            "iconPath": "icons/home.png",          // 图片路径,icon 大小限制为 40kb,建议尺寸为 81px * 81px,不支持网络图片。当 position 为 top 时,不显示 icon。
            "selectedIconPath": "icons/homeO.png"  // 选中时的图片路径,icon 大小限制为 40kb,建议尺寸为 81px * 81px,不支持网络图片。当 position 为 top 时,不显示 icon。
         },{
            "pagePath": "pages/category/index",
            "text": "分类",
            "iconPath": "icons/category.png",
            "selectedIconPath": "icons/category-o.png"
         },{
            "pagePath": "pages/cart/index",
            "text": "购物车",
            "iconPath": "icons/cart.png",
            "selectedIconPath": "icons/cart-o.png"
         },{
            "pagePath": "pages/user/index",
            "text": "我的",
            "iconPath": "icons/my.png",
            "selectedIconPath": "icons/my-o.png"
         }
    ],
    "position": "bottom",                       // tabBar 的位置,仅支持 bottom / top
    "custom": false,                            // 自定义 tabBar
  },
  "networkTimeout":{                            // 各类网络请求的超时时间,单位均为毫秒。
    "request": 60000,                           // wx.request 的超时时间,单位:毫秒。
    "connectSocket": 60000,                     // wx.connectSocket 的超时时间,单位:毫秒。
    "uploadFile": 60000,                        // wx.uploadFile 的超时时间,单位:毫秒。
    "downloadFile": 60000                       // wx.downloadFile 的超时时间,单位:毫秒。
  },
  "debug": false,                               // 是否开启 debug 模式,默认关闭
  "functionalPages": false,                     // 是否启用插件功能页,默认关闭
  "subpackages": {                              // 分包结构配置
      
  },
  "preloadRule":{                               // 分包预下载规则
      
  },
  "workers": "",                                // Worker 代码放置的目录
  "requiredBackgroundModes": ["audio", "location"],        // 需要在后台使用的能力,如「音乐播放」    audio: 后台音乐播放;location: 后台定位
  "plugins": {                                  // 使用到的插件
      
  },
  "resizable": false,                           // PC 小程序是否支持用户任意改变窗口大小(包括最大化窗口);iPad 小程序是否支持屏幕旋转。默认关闭
  "usingComponents":{                           // 全局自定义组件配置
      "SearchInput": "../../components/SearchInput/SearchInput"
  },
  "permission": {                               // 小程序接口权限相关设置
      "scope.userLocation": {
          "desc": "你的位置信息将用于小程序位置接口的效果展示" // 小程序获取权限时展示的接口用途说明。最长 30 个字符【高速公路行驶持续后台定位】
      }
  },
  "sitemapLocation": "sitemap.json",            // 指明 sitemap.json 的位置
  "style": "v2",                                // 指定使用升级后的weui样式
  "useExtendedLib": {                           // 指定需要引用的扩展库
      "kbone": true,                            // 多端开发框架
      "weui": true                              // WeUI 组件库
  },
  "entranceDeclare": {                          // 微信消息用小程序打开
      "locationMessage": {
          "path": "pages/index/index",
          "query": "foo=bar"
      }
  },
  "darkmode": false,                            // 小程序支持 DarkMode
  "themeLocation": "/path/to/theme.json",       // 指明 theme.json 的位置,darkmode为true为必填
  "lazyCodeLoading": "requiredComponents",      // 配置自定义组件代码按需注入
  "singlePage": {                               // 单页模式相关配置
      "navigationBarFit": ""                    // 导航栏与页面的相交状态,值为 float 时表示导航栏浮在页面上,与页面相交;值为 squeezed 时表示页面被导航栏挤压,与页面不相交。默认自动调整,若原页面是自定义导航栏,则为 float,否则为 squeezed
  }

}

页面配置 

{
  "navigationBarBackgroundColor": "#ffffff",            // 导航栏背景颜色,如 #000000
  "navigationBarTextStyle": "black",                    // 导航栏标题颜色,仅支持 black / white
  "navigationBarTitleText": "微信接口功能演示",            // 导航栏标题文字内容
  "navigationStyle": "default",                         // 导航栏样式,仅支持default 默认样式:custom 自定义导航栏,只保留右上角胶囊按钮。
  "backgroundColor": "#eeeeee",                         // 窗口的背景色
  "backgroundTextStyle": "light",                       // 下拉 loading 的样式,仅支持 dark / light
  "backgroundColorTop": "#ffffff",                      // 顶部窗口的背景色,仅 IOS 支持
  "backgroundColorBottom": "#ffffff",                   // 底部窗口的背景色,仅 IOS 支持
  "enablePullDownRefresh": false,                       // 是否开启当前页面下拉刷新。
  "onReachBottomDistance": 50,                          // 页面上拉触底事件触发时距页面底部距离,单位为px。
  "pageOrientation": "portrait",                        // 屏幕旋转设置,支持 auto / portrait / landscape
  "disableScroll": false,                               // 设置为 true 则页面整体不能上下滚动。只在页面配置中有效,无法在 app.json 中设置
  "usingComponents": {                                  // 页面自定义组件配置
      
  },
  "initialRenderingCache": "static",                    // 页面初始渲染缓存配置
  "style": "default",                                   // 启用新版的组件样式
  "singlePage": {                                       // 单页模式相关配置
      
  }
}

sitemap 配置

{
  "rules":[
    {
        "action": "allow",            // 命中该规则的页面是否能被索引,仅支持 "allow"、"disallow"
        "page": "path/to/page",       // "*"、页面的路径。* 表示所有页面,不能作为通配符使用
        "params": ["a", "b"],         // 当 page 字段指定的页面在被本规则匹配时可能使用的页面参数名称的列表(不含参数值)
        "matching": "exact",          // 当 page 字段指定的页面在被本规则匹配时,此参数说明 params 匹配方式
                                      // exact	当小程序页面的参数列表等于 params 时,规则命中
                                      // inclusive	当小程序页面的参数列表包含 params 时,规则命中
                                      // exclusive	当小程序页面的参数列表与 params 交集为空时,规则命中
                                      // partial	当小程序页面的参数列表与 params 交集不为空时,规则命中
        "priority": 1                 // 优先级,值越大则规则越早被匹配,否则默认从上到下匹配
    }, {
        "action": "disallow",
        "page": "path/to/page"
    }
  ]
}

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值