vue2 cli 本地 开发 跨域问题处理
配置目录:config>index.js
proxyTable: { '/api': { //代理 target: 'http://175.27.244.59:3000/',//服务端地址和端口 changeOrigin: true,//启动代理 pathRewrite: {//重写路径 '^/api': '' } } },
方法:
实际接口:http://175.27.244.59:3000/api/getArcInfo
axios.get('/api/getArcInfo').then(res => { console.log(res); })