Solution:
Add a file in the root directory of the vue project. The file needs to be written in the following way
= { lintOnSave: true, devServer: { proxy: { // proxy all requests starting with /api to jsonplaceholder '/api': { target: 'http://localhost:8080', //Proxy interface changeOrigin: true, pathRewrite: { '^/api': '/mock' //Proxy path } } } } }
Then you can use /api in your code instead of http://localhost:8080/mock
The above article "Use proxy forwarding" in the implementation of vue cli3.0 is all the content I share with you. I hope you can give you a reference and I hope you support me more.