Vue-axios 设置请求头问题

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

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

猜你喜欢

转载自blog.csdn.net/weixin_39513821/article/details/84849975