top
本文目录
一、manifest.json里面可以设置请求超时的时间,networkTimeout
二、再在请求的封装uni.request里添加提示

uniapp请求超时处理(request请求status状态为canceled)

一、manifest.json里面可以设置请求超时的时间,networkTimeout

这里是官方文档

 

"networkTimeout":{
    "request":60000
},

二、再在请求的封装uni.request里添加提示

fail: (err)=> {
        uni.hideLoading();
        uni.showModal({
            title: '提示',
            showCancel: false,
            content: '请求超时'
        })
}
#经测试是会触发的
THE END
icon
0
icon
打赏
icon
分享
icon
二维码
icon
海报