axios 设置超时

以post请求为例:

axios.post(url, params, {timeout: 1000 * 60 * 2}).then(function(resp){

    console.log(resp)

}).catch(() => {

    console.log('111')

})

url:请求地址

params:请求参数

{timeout: 1000 * 60 * 2}:设置超时,超时时间为2分钟

猜你喜欢

转载自blog.csdn.net/wh13267207590/article/details/80651878