vue $http get,post,put,delete方法使用
get方法,此方法向服务器获取我们需要的数据,如果需要传入参数,则需要paramsclick(){this.$http.post('/xxx',{params:{'page':1,'size':10}}).then((response) =>{console.log(response)})}delete方法同上。put方法 .PUT的方法就是其字面表意,将client的资源放在请..
·
get方法,此方法向服务器获取我们需要的数据,如果需要传入参数,则需要params
click(){
this.$http.post('/xxx',{
params:{'page':1,'size':10
}
}).then((response) =>{
console.log(response)
})
}
delete方法同上。
put方法 .PUT的方法就是其字面表意,将client的资源放在请求URI上,因此
form:{
'page':1,
'size':2
}
click(){
this.$http.put('/xxx',this.form).then((response) =>{
console.log(response)
})
}
post方法如上,将需要传给服务器的资源定义一个变量 放在url里面传给服务器更多推荐
已为社区贡献28条内容
所有评论(0)