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

2020-06-15  本文已影响0人  ForeverYoung_06

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方法直接把参数写在{}就可以了。
都要注意跨域问题。

上一篇 下一篇

猜你喜欢

热点阅读