1、过程

    1)在config-->index.js中配置代理

 
proxyTable: {
  '/api/**': {
    target: 'http://**', // 你接口的域名
    // secure: false,      // 如果是https接口,需要配置这个参数
    changeOrigin: true,     // 如果接口跨域,需要进行这个参数配置
  }
},

    2)在dev.evn.js配置默认路径

 
module.exports = {
  NODE_ENV: '"development"',
  ENV_CONFIG: '"dev"',
  BASE_API: '"http://localhost:8080"' // 要配置本地地址,配置后台地址不能访问
}

 

2、原因

在dev.evn.js也配置了后台地址

3、参考

https://www.jianshu.com/p/19a6aefca350

https://www.cnblogs.com/first-time/p/7082806.html

Logo

前往低代码交流专区

更多推荐