小程序超时配置及使用
2020-08-28 本文已影响0人
小飞5
只需在app.json配置
"networkTimeout":{
"request":3000, //网络请求超时
"uploadFile": 10000, //上传文件超时
"downloadFile": 10000 //下载超时
},
然后在封装的request请求中添加fail
fail: (data) => {
wx.hideLoading()
wx.showModal({
content: "请求超时...",
showCancel: false,
success: (res) => {
this.request(url, method, data, header, fun)
}
})
}