vue axios 携带参数

跟大家分享两种axios携带参数的方法(可用于前后端传值) :

A 相当于另起一个名字 ,可以在后台通过A获取到B

B 即将被携带的数据 , 常用 this.变量名

1   this.axios.post/get('url' , {params : {A : B}})

  .then(res =>{}).catch({})

2   this.axios.post/get(`url?A=${B}`)

  .then(res =>{}).catch(res=>{})

posted @ 2020-11-09 21:01  樱樱  阅读(1615)  评论(0)    收藏  举报