【发布时间】:2020-07-05 23:42:03
【问题描述】:
所以我想将 Axios 添加到 Vue 项目中。我通过发出vue add axios 做到了这一点。它告诉我,安装成功,但后来不知何故出现 5 个错误。我不完全明白为什么它告诉我它已安装,而似乎还有一些工作正在进行,更重要的是:这个错误是关于什么的??
我猜它实际上安装了 Axios,但它无法生成它通常添加的默认代码?那不好吗?为什么要添加代码?为什么我不能将它用作依赖管理器?
$ vue add axios
WARN There are uncommited changes in the current repository, it's recommended to commit or stash them first.
? Still proceed? Yes
???? Installing vue-cli-plugin-axios...
+ vue-cli-plugin-axios@0.0.4
updated 1 package and audited 25608 packages in 10.502s
40 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
✔ Successfully installed plugin: vue-cli-plugin-axios
???? Invoking generator for vue-cli-plugin-axios...
⠋ Running completion hooks...error: 'options' is defined but never used (no-unused-vars) at src/plugins/axios.js:42:32:
40 | );
41 |
> 42 | Plugin.install = function(Vue, options) {
| ^
43 | Vue.axios = _axios;
44 | window.axios = _axios;
45 | Object.defineProperties(Vue.prototype, {
1 error found.
【问题讨论】: