当前位置:   article > 正文

【愚公系列】2023年02月 微信小程序-app.json配置属性之networkTimeout_小程序默认请求超时时间

小程序默认请求超时时间


一、app.json配置属性之networkTimeout

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

属性类型必填默认值说明
requestnumber60000wx.request 的超时时间,单位:毫秒。
connectSocketnumber60000wx.connectSocket 的超时时间,单位:毫秒。
uploadFilenumber60000wx.uploadFile 的超时时间,单位:毫秒。
downloadFilenumber60000wx.downloadFile 的超时时间,单位:毫秒。

配置案例如下:

{
  "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"
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51

在这里插入图片描述

声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号