Uncaught TypeError: this.$http is undefined

Vue与后端数据交互问题

使用this.$http.get('请求地址')来发送请求。浏览器报错:Uncaught TypeError: this.$http is undefined

解决

需要引入库:vue-resource

<script src="https://cdn.staticfile.org/vue-resource/1.5.1/vue-resource.min.js"></script>

vue2.0版本的推荐使用axios

使用 cdn:

<script src="https://unpkg.com/axios/dist/axios.min.js"></script>

<script src="https://cdn.staticfile.org/axios/0.18.0/axios.min.js"></script>

使用 npm:

$ npm install axios

使用 bower:

$ bower install axios

使用 yarn:

$ yarn add axios
点击显示
· You are running a development build of Vue.
· jquery on方法_jquery从哪个版本开始支持on方法
· Uncaught TypeError: $(...).on is not a function
· layui table tr根据数据修改样式_修改tr背景颜色
· 超级飞侠中皮皮的简笔画_图片