vue代理设置

在vue.config.js中设置

  devServer: {
    port: 1888,
    proxy: {
      '/api': {
        //本地服务接口地址
        target: 'http://localhost',
        //远程演示服务地址,可用于直接启动项目
        //target: 'https://saber.bladex.vip/api',
        ws: true,
        pathRewrite: {
          '^/api': '/'
        }
      }
    }
  }

 

 

posted @ 2020-03-20 15:10  kitterKing  阅读(1848)  评论(0编辑  收藏  举报