We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AbortController:从 v0.22.0 开始,Axios 支持以 fetch API 方式—— AbortController 取消请求。
CancelToken:此 API 从 v0.22.0 开始已被弃用,不应在新项目中使用。
// method 1 const CancelToken = axios.CancelToken; const source = CancelToken.source(); axios.post('/user/12345', { name: 'new name' }, { cancelToken: source.token }); source.cancel('Operation canceled by the user.');
// method 2 const CancelToken = axios.CancelToken; let cancel; axios.get('/user/12345', { cancelToken: new CancelToken(function executor(c) { cancel = c; }) }); cancel();
// method 3 const controller = new AbortController(); axios.get('/foo/bar', { signal: controller.signal }).then(function(response) { //... }); controller.abort();
The text was updated successfully, but these errors were encountered:
No branches or pull requests
应用场景
具体实现
The text was updated successfully, but these errors were encountered: