axios 设置超时时间 timeout


全局设置网络超时

axios.defaults.timeout = 30000;

 单独对某个请求设置网络超时

let timeout = parseInt(paramsTimeout);
this.$http.post(url, params, {timeout: timeout})
  .then(res => {
    console.log('response='+response);
  })
  .catch(reason => {
    console.log('reason'+reason);
  })
})

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM