飞道的博客

axios 设置请求头------vue

359人阅读  评论(0)

在axios向后端传参时需要设置请求头,确保请求参数的格式为JSON字符串(此时用JSON.stringify(obj)无效时)

this.$axios({
   
      method:'',
      url:'',
      headers: {
   
          'Content-Type': 'application/json',//设置请求头请求格式为JSON
          'access_token': this.token //设置token 其中K名要和后端协调好
      },
      params:{
   }
}).then((response)=>{
   })


转载:https://blog.csdn.net/ZiChen_Jiang/article/details/108256563
查看评论
* 以上用户言论只代表其个人观点,不代表本网站的观点或立场