美文网首页
VUE项目get方法和post方法传参的区别

VUE项目get方法和post方法传参的区别

作者: ForeverYoung_06 | 来源:发表于2020-06-15 16:32 被阅读0次

GET方法

 _this.$axios
      .get("/api", { params: headdata })
      .then(res=>{
      console.log(res);
      })

POST方法

_this.$axios
            .post('/api', {
                user_id: 458787
            })
            .then(res=> {
                console.log(res);
            });

get方法传参必须要放在params中,post方法直接把参数写在{}就可以了。
都要注意跨域问题。

相关文章

网友评论

      本文标题:VUE项目get方法和post方法传参的区别

      本文链接:https://www.haomeiwen.com/subject/muumuhtx.html