vue 前端反向代理后台,解决跨域问题

// 和 src 同层的 config 文件夹下的 index.js

dev 里面的 

 

// Paths
    assetsSubDirectory: 'static',
    assetsPublicPath: '/',
    proxyTable: {
      '/apis': {
        target: ' ',//后端接口地址
        changeOrigin: true,  //是否跨域
        pathRewrite: {
          '^/apis':''   //需要rewrite重写的,
        }
      }
    },
 
//复制粘贴即可用
posted @ 2020-09-20 11:32  薛定谔_猫  阅读(804)  评论(0)    收藏  举报