This time I will show you how to use Vue to implement proxy proxy, and what are the precautions for using Vue to implement proxy proxy. The following is a practical case, let's take a look.
// config/index.js 文件 proxyTable: { '/api': { target: 'http://192.168.149.90:8080/', // 设置你调用的接口域名和端口号 changeOrigin: true, // 跨域 pathRewrite: { '^/api': '/' } } },
time=2017-07-07 14:57:22', just write '/api/xxx/duty?time=2017-07-07 14:57:22'
In dev.env.jsConfigure the development environmentRequest address
// config/dev.env.js 文件 module.exports = merge(prodEnv, { NODE_ENV: '"development"', ADMIN_SERVER: '"/api/"', });
const adminServer = axios.create({ baseURL: process.env.ADMIN_SERVER, });
How to use vue source code to parse the event mechanism
How to operate JS to obtain the city and geographical location of the user
The above is the detailed content of How to use Vue to implement proxy proxy. For more information, please follow other related articles on the PHP Chinese website!