脚本宝典收集整理的这篇文章主要介绍了解决报错:axios is not defined,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
好家伙,来解决报错:axios is not defined
写前端嘛,修bug,不寒颤
进入页面一片空白
来看看报错:
1.axios在安装时:npm install axios --save-dev
2.在项目中的main.js文件中添加配置:
import axios from 'axios' Vue.prototype.$axios = axios
3.将组件中调用axios的语句
axios.post //get,catch之类的,改法一样
改为
this $axios.post
于是就解决了"axios is not defined "报错
页面回来了
搞定!
以上是脚本宝典为你收集整理的解决报错:axios is not defined全部内容,希望文章能够帮你解决解决报错:axios is not defined所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。