使用axios

var CancelToken = axios.CancelToken;
var source = CancelToken.source();

axios.get('/user/12345', {
  cancelToken: source.token
}).catch(function(thrown) {
  if (axios.isCancel(thrown)) {
    console.log('Request canceled', thrown.message);
  } else {
    // handle error
  }
});

// cancel the request (the message parameter is optional)
source.cancel('Operation canceled by the user.');

 

相关文章:

  • 2021-10-14
  • 2023-03-14
  • 2022-01-04
  • 2022-03-06
  • 2021-11-09
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 1970-01-01
  • 2021-07-20
  • 2022-01-26
  • 2021-11-10
  • 2021-07-21
  • 2022-02-03
  • 2022-12-23
相关资源
相似解决方案