【愚公系列】2022年02月 微信小程序-app.json配置属性之networkTimeout

2022-02-23 14:46:21 浏览数 (1)

文章目录

  • 一、app.json配置属性之networkTimeout

一、app.json配置属性之networkTimeout

全局设置各类网络请求的超时时间,单位均为毫秒。

属性

类型

必填

默认值

说明

request

number

60000

wx.request 的超时时间,单位:毫秒。

connectSocket

number

60000

wx.connectSocket 的超时时间,单位:毫秒。

uploadFile

number

60000

wx.uploadFile 的超时时间,单位:毫秒。

downloadFile

number

60000

wx.downloadFile 的超时时间,单位:毫秒。

配置案例如下:

代码语言:javascript复制
{
  "entryPagePath": "pages/index/index",
  "pages": [
    "pages/index/index",
    "pages/getOpenId/index",
    "pages/getMiniProgramCode/index",
    "pages/deployService/index",
    "pages/createCollection/index",
    "pages/uploadFile/index",
    "pages/selectRecord/index",
    "pages/updateRecord/index",
    "pages/updateRecordResult/index",
    "pages/updateRecordSuccess/index",
    "pages/sumRecord/index",
    "pages/sumRecordResult/index"
  ],
  "window": {
    "backgroundColor": "#F6F6F6",
    "backgroundTextStyle": "light",
    "navigationBarBackgroundColor": "#F6F6F6",
    "navigationBarTitleText": "云开发 QuickStart",
    "navigationBarTextStyle": "black"
  },
  "tabBar": {
    "list": [
      {
        "pagePath": "pages/index/index",
        "text": "首页"
      },
      {
        "pagePath": "pages/getOpenId/index",
        "text": "看资讯"
      },
      {
        "pagePath": "pages/getMiniProgramCode/index",
        "text": "我的"
      }
    ],
    "backgroundColor": "#fff",
    "color": "#000",
    "selectedColor": "#0286f1"
  },
  "networkTimeout": {
    "request": 10000,
    "downloadFile": 10000,
    "connectSocket": 10000,
    "uploadFile": 10000
  },
  "sitemapLocation": "sitemap.json",
  "style": "v2"
}

0 人点赞