Vue解决跨域之反向代理

目录 : config/index.js

module.exports = { dev: { // Paths assetsSubDirectory: 'static', assetsPublicPath: '/', //代理配置 proxyTable: { '/api':{ //使用api 来代替 http://localhost:3000 target:"http://localhost:3000", // 目标源 changeOrign:true, //改变源地址 是否跨域 pathRewrite:{ //路径重写 '^/api':'http://localhost:3000' } } },}

 

原文地址:https://www.cnblogs.com/yxdlm/p/10480385.html