该错误是因为在axios中没有error()函数而引起的。错误可以通过使用catch()函数来解决。 catch()可以在.then()的末尾添加一个处理错误响应的方法。示例如下:
axios.delete('example.com/user/123') .then(function (response) { console.log(response); }) .catch(function (error) { console.log(error); });
在这个例子中,如果请求失败,catch()将会处理错误响应。