1-2交互 vue-resouce
来源:互联网 发布:c语言volatile的作用 编辑:程序博客网 时间:2024/06/06 19:10
vue交互方式
get
get交互如下所示:两个方法,一个成功,一个失败。
methods:{ get: function () { this.$http.get('1-1.html').then(function (res) { res是一个对象,里面包含状态码,包含数据 console.log(res.data); }, function () { console.log(2) }) }}与服务器做交互:
methods:{ get: function () { this.$http.get('a.php',{ a:1,b:2 //后面是发送给服务器的参数 }).then(function (res) { console.log(res.data); }, function () { console.log(2) }) }}
post
methods:{ get: function () { this.$http.post('a.php',{ a:1,b:2 },{ emulateJSON:true //post提交需要写一个这样的声明 }).then(function (res) { console.log(res.data); }, function () { console.log(2) }) }}
jsonp
接口
https://sug.so.360.cn/suggest?callback=suggest_so&word=a
<input type="button" value="按钮" @click="get()">
methods:{ get: function () { this.$http.jsonp('https://sug.so.360.cn/suggest',{ word:'a' },{ }).then(function (res) { console.log(res.data.s); }, function (res) { console.log(res.status); }); }}
0 0
- 1-2交互 vue-resouce
- vue-resouce设置请求头
- Vue GET交互
- vue POST交互
- Vue jsonp交互
- vue数据交互
- vue数据交互
- Vue-数据交互
- Vue GET交互
- 数据交互vue-resource
- Vue前后台交互
- Vue之交互
- vue-resource交互写法
- iOS与vue交互
- download resouce
- vue-交互 -取值- 赋值
- vue 属性绑定和交互
- vue.js 2.0 axios交互
- CURL使用
- Storm-JDBC 中Date类型转换bug
- python+selenium常用函数
- KNN分类算法Python实现
- OpenCV使用小结
- 1-2交互 vue-resouce
- flask部署-Ubuntu下使用nginx+uwsgi+supervisor部署flask应用
- 邮票分你一半
- Android源码/框架源码分析
- 2017年上半年(2月-9月个人学习计划)
- 8.10.3.1 How the Query Cache Operates
- 如何快速对系统重启问题进行归类
- 【Camera】Android平台Camera实时滤镜实现方法
- linux笔记-基础篇