get request for $http of vue plus params operation
- 2021-09-16 06:12:29
- OfStack
vue GET transfer parameters should be added with params
this.$http.get('/operation/customer/question/edits',{params:{id: 10}})
In addition, axios is now officially recommended by VUE
vue-resource is not updated
Additional knowledge: post get is different in vue request
I am learning vue, project post request, get request are used, I found that the way to pass the parameters is not one kind.
An example of an post request:
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') ;
});
}
An example of an get request:
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;
});
},