在 config/index.js 配置文件中,添加

dev: {
proxyTable: {
'/ssp/withdraw': {
target: 'http://dev.home.phiwifi.com', // 接口域名
changeOrigin: true, // 是否跨域
pathRewrite: {
'^/ssp/withdraw': '/ssp/withdraw' // 需要rewrite重写的
      }
}
}


具体调用方式:
var obj = {
pageSize: 20
}
this.$http.get( '/apis/health/list',{params: obj}) .then(function(res){ // 成功回调 },function(){ alert("error") })

或者
let hostName = location.host;
let protoType = location.protocol;
this.$axios({
method: "post",
url: protoType + "//" + hostName + "/ssp/withdraw/user_login",
  data: params
})

注意:修改脚手架的文件后一定要npm run dev ,重启服务后才能生效

相关文章:

  • 2022-12-23
  • 2021-05-05
  • 2021-04-06
  • 2022-12-23
  • 2022-02-11
  • 2021-06-17
  • 2021-10-11
  • 2022-12-23
猜你喜欢
  • 2021-10-14
  • 2022-12-23
  • 2021-04-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案