Since vue2.0 officially chose Axios to complete the AJAX request, I recently started using Axios to write Ajax requests. The architecture I used before was both front and back, so there was a cross-domain problem. I wrote the Post request method based on Axios's official documentation on GitHub, but the error in the browser console console output cross-domain issues.
Server I've done the cross-domain processing in the header of the HTTP header message
Header
But the JS client I follow the official document operation, found that there are still cross-domain issues, and then I search the relevant solution on the Internet, I found the need in the JS client, that is, the HTTP request message header set encoding format Content-type to application/ x-www-form-urlencoded
Axios ({ method: ' Post ', URL: ' Request address ', data:{ param: ' parameter ' ) }, headers: { ' content-type ': ' application/x-www-form-urlencoded ', }}). Then (function(res) { return res.data;});
If this is not the case, the post request is accessible to the server, but the server does not return to the client properly, and the output cross-domain error in the console console in the browser
Vue Axios cross-domain