Axios in vue sends request parameters garbled

The solution is to configure in the request header

config.headers['Content-Type'] ='application/json;charset=UTF-8'

Just a quick note about
**content-type**
The Content-Type header tells the client the content type of the content that is actually returned.

Content-Type (content type), generally refers to the Content-Type existing in the webpage, which is used to define the type of network file and the encoding of the webpage, and determine the form and encoding of the browser to read this file. This is often seen The result of clicking on some PHP pages is to download a file or an image instead.

Grammar format:
Content-Type: application/json; charset=utf-8
indicates that the transmission type is json and the encoding format is utf-8

Common media format types are as follows:
text/html: HTML format
text/plain: plain text format
text/xml: XML format
image/gif: gif image format
image/jpeg: jpg image format
image/png: png image format

The media format type at the beginning of application:
application/xhtml+xml: XHTML format
application/xml: XML data format
application/atom+xml: Atom XML aggregation format
application/json: JSON data format
application/pdf: pdf format
application/msword: Word Document format
application/octet-stream: Binary stream data (such as common file downloads)
application/x-www-form-urlencoded: the default encType in the form, form form data is encoded into key/value format and sent to the server (form default format for submitting data)

Guess you like

Origin blog.csdn.net/m0_49016709/article/details/125197505