vue Cli 安装axios
1、通过命令下载 axios 当前项目 npm install axios
D:\study\my-project>npm install axios npm WARN ajv-keywords@3.5.2 requires a peer of ajv@^6.9.1 but none is installed. You must install peer dependencies yourself. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\watchpack-chokidar2\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\webpack-dev-server\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) + axios@0.20.0 added 1 package from 1 contributor in 30.477s 29 packages are looking for funding run `npm fund` for details D:\study\my-project>
2、如果想看自己是否下载成功 打开你的package.json 看看有没有axios的版本信息
3、 打开你的main.js去做配置 把我给你圈着的填进去 就ok
在相对应的页面上如何使用axios
本文大部分转载自:https://www.cnblogs.com/l-ialiu/p/12627081.html 并对博客做了进一步编辑