Objective:
General cross-domain problems as long as the backend configuration, it is not necessary to do the front-end processing, but there is no guarantee that you encounter all the backend can handle this problem very well, this time may require the front-end setup agent to solve the problem.
Configuration method:
1. Config/index.js
proxytable: { '/api ': { // the domain name to access the interface // Secure: False, //If it is an HTTPS interface, this parameter needs to be configured true// If the interface is cross-domain, this parameter configuration is required pathrewrite: { ' ^/api ': '// Override interface Access }}} , ' 192.168.8.1 ',// native IP or localhost
Note:/api must have, the name can be different.
2. Interface access address changed to native access address + port + "/api"
default { domin:"Http://192.168.8.1:8080/api"// Native access address + "/api" (also available with HTTP://LOCALHOST:8080/API) }
You can run it again.
Vue-webpack Project Local Development environment Setup agent resolves cross-domain issues