欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

vue的$http的get請求要加上params操作

 更新時(shí)間:2020年11月12日 10:04:50   作者:張超帥  
這篇文章主要介紹了vue的$http的get請求要加上params操作,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧

vue GET傳遞參數(shù)要加上params

this.$http.get('/operation/customer/question/edits',{params:{id: 10}})

另外說一句,現(xiàn)在VUE官方推薦使用axios

vue-resource不更新了

補(bǔ)充知識:vue請求中 post get傳參方式是不同的哦

我在學(xué)習(xí)vue,項(xiàng)目中post請求,get請求都用到了,我發(fā)現(xiàn)傳參方式是不一樣的。

post請求的例子:

checkin (){
this.$http.post('my url',{
mobilePhone:this.phone,
password:this.password
},{
emulateJSON: true
}
).then(function(res){
this.$root.userid=res.data.userid;
console.log(this.$root.userid)
this.$router.push('/content') ;
});
}

get請求的例子:

nextOne2 (){
this.$http.get('http://192.168.100.31:8080/wenchuang/guid/addProductFile',{
params: {
filename:this.formData.chanpinjia,
userid: this.$root.userid
},
},{
emulateJSON: true
}
).then(function(res){
this.step++;
this.bianliang= res.data.files.id;
});
},

以上這篇vue的$http的get請求要加上params操作就是小編分享給大家的全部內(nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論