jsonp请求方法:
this.$http.jsonp(this.getUrl,{//getUrl是我放在data中的变量
params:{//参数
wd:this.tl
},
jsonp:'cb'
}).then(function(res){
this.myData = res.body.s;
console.log(res);
},function(){
console.log("请求失败!!!")
});
get请求方式
this.$http.get(this.url).then(function(response) {
console.log(response.body);
},function(){
console.log("error");
});
post:
this.$http.post(this.url, formData).then((response) => {
console.log(response.data);
}, (response) => {
console.log("error");
});
网友评论