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 (obj) is invalid at this time)
this.$axios({ method:'', url:'', headers: { 'Content-Type': 'application/json',//Set the request header request format to JSON 'access_token': //Set the token, where the K name should be coordinated with the backend }, params:{} }).then((response)=>{})
Let's take a look at the content of the axios setup request header
axios sets the Authorization and cookie information in the request header:
GET Request
(urlString, { headers: { 'Authorization': 'Bearer ' + token, "Cookie" : 'sessionId=' + sessionId + '; recId=' + recId, ... }, params: { param1: string, param2: string }, ... } ) .then(res => fn) .catch(e => fn)
POST request
(urlString, { data: data, ... }, { headers: { 'Authorization': 'Bearer ' + token, "Cookie" : 'sessionId=' + sessionId + '; recId=' + recId, ... } } ) .then(res => fn) .catch(e => fn)
Summarize
The above is the Vue-axios request header problem introduced to you by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. Thank you very much for your support for my website!