【发布时间】:2020-10-01 19:39:45
【问题描述】:
基本上,我的问题正是https://github.com/axios/axios/issues/583。可以通过throw new axios.Cancel('Operation canceled by the user.');.. 完成。但是我如何在 nuxt axios 模块中做到这一点?我在文档中看不到它,我尝试了 $axios.Cancel('Error') 但返回 $axios.Cancel 不是构造函数
基本上,我正在寻找类似下面的 sn-p 的东西:
axios.interceptors.response.use(function (response) {
throw new axios.Cancel('Operation canceled by the user.');
}, function (error) {
return Promise.reject(error);
});
强调throw new axios.Cancel
【问题讨论】: