axios中的Get和Post请求
他们俩个的区别就是get因为参数会放在url中,所以他的安全性较差,请求的数据长度有限制而post请求是没有的长度限制,请求数据是放在body中;get请求刷新页面或者回退没有影响而post请求回退时会重新提交数据请求。通俗点来说get请求就是去取获取数据的,post请求就是去提交数据的。get请求会被保存在浏览器历史记录当中但post不会。get请求只能用url编码,而post可以多种。get请
·
通俗点来说get请求就是去取获取数据的,post请求就是去提交数据的
他们俩个的区别就是get因为参数会放在url中,所以他的安全性较差,请求的数据长度有限制而post请求是没有的长度限制,请求数据是放在body中;
get请求刷新页面或者回退没有影响而post请求回退时会重新提交数据请求。
get请求可以缓存,post请求不会被缓存。
get请求会被保存在浏览器历史记录当中但post不会。
get请求只能用url编码,而post可以多种
Get请求:
this.$axios.get('路径',{
params: {
id:1
}
}).then(res=>{
console.log(res.data);
},err=>{
console.log(err);
})
post请求:
this.$axios.post('/url',{
id:1
}).then(res=>{
console.log(res.data);
},err=>{
console.log(err);
})
更多推荐
已为社区贡献1条内容
所有评论(0)