vue中如何获取到webpack代理后的地址

新手上路,请多包涵

问题描述

 location.href='/PageOffice/text/modelToText?cacheId=${vm.contaractId}';
 我想要location.href打开http://192.168.61.120:8081/PageOffice/text/modelToText?cacheId=${vm.contaractId}这个地址,相当于代理后的地址
  '/PageOffice/*': {
    target: 'http://192.168.61.120:8081',
    changeOrigin: true,
   /*  pathRewrite: {
      '/PageOffice': '/'
    } */
    pathRewrite: {'/PageOffice':''}
  },

问题出现的环境背景及自己尝试过哪些方法

相关代码

// 请把代码文本粘贴到下方(请勿用图片代替代码)
proxyTable: {

  '/pty': {
    //target: 'https://www.easy-mock.com/mock/5a1e9b811f943e71b6c7b207/orange',
    target: 'http://59.110.141.230:8080/pty',
    changeOrigin: true,
    pathRewrite: {
      '^/pty': ''
    }
  },
  '/WebReport': {
    target: 'http://59.110.141.230:8082/WebReport',
    changeOrigin: true,
    pathRewrite: {
      '^/WebReport': ''
    }
  },
  '/PageOffice/*': {
    target: 'http://192.168.61.120:8081',
    changeOrigin: true,
   /*  pathRewrite: {
      '/PageOffice': '/'
    } */
    pathRewrite: {'/PageOffice':''}
  },
},

你期待的结果是什么?实际看到的错误信息又是什么?

阅读 4.5k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题