1、在config文件夹下新建文件proxyConfig.js,代码如下

module.exports = {
  proxy: {
    '/': {    //将www.exaple.com印射为/apis
      target: 'http:/localhost:8080',  // 接口域名   
      secure: false,  // 如果是https接口,需要配置这个参数
      changeOrigin: true,  //是否跨域
      pathRewrite: {
        '^': ''   //需要rewrite的,
      }
    }
  }
}

2、在config文件夹下的index.js中引入,截图如下

vue-调试配置代理

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-09
  • 2021-10-11
  • 2021-12-30
  • 2021-08-26
猜你喜欢
  • 2022-12-23
  • 2021-12-12
  • 2021-12-26
  • 2021-05-14
  • 2022-12-23
  • 2022-12-23
  • 2021-11-16
相关资源
相似解决方案