vue-cli 开发阶段跨域处理

2017-12-06  本文已影响0人  秃头大叔
1512529973(1).jpg
//config文件夹内index.js  dev 配置     
  proxyTable: {
      '/JydDataPlatform': {
        target: 'http://XXX.cn',
        changeOrigin: true,
        pathRewrite: {
          '^/JydDataPlatform': ''
        }
      }
    }


// 请求路径     解析的完整路径为'http://XXX.cn/JydDataPlatform/login/getVerificationCode'
that.$http.post("/JydDataPlatform/login/getVerificationCode").then(response=>{
      console.log(response);
 })

方法二 https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi Allow-Control-Allow-Origin: *插件

上一篇 下一篇

猜你喜欢

热点阅读