【发布时间】:2018-12-14 19:14:20
【问题描述】:
我正在将 Vue Cli 用于一个包含 .eslintrc.js 的项目,我正在努力坚持。它在下面的代码中发现了一个错误。
getTags (url) {
axios.get('http://example.test/api' + url).then(response => {
this.tags = response.data.data
}).catch(error => {
this.tags = []
})
}
确切的错误是这部分代码(在.catch之后)
(error => {
this.tags = []
this.loadingTags = false
})
错误是[eslint] Expected error to be handled. (handle-callback-err)
但我很困惑,.catch(error => 没有发现错误吗?我看不到问题
【问题讨论】:
-
也许是因为您没有对
error参数本身做任何事情?例如,尝试记录它(console.log(error))。