axios set request Vue

When axios passes parameters to the backend, you need to set the request header to ensure that the format of the request parameter is a JSON string (when JSON.stringify(obj) is invalid at this time)

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


Today is the end of all projects, but some of them have not been fully grasped. In the days to come, I will slowly make up for it and strive for improvement. The interview questions should be written down comprehensibly, and the resume should be fully familiar

Guess you like

Origin blog.csdn.net/weixin_48193717/article/details/108654198