Vue - 跨域问题解决方法。

VUE访问接口的时候,很可能出现跨域请求,从而被提供接口的服务器拒绝,这个问题可以直接在VUE里面解决,解决方法:在vue.config.js里面加入配置信息。

在module.exports中加入:

  devServer: {
    proxy:'http://localhost:8089'
  },

这里的proxy,是真正要访问的提供接口的服务器url !

参考:

https://blog.csdn.net/wh_xmy/article/details/87705840

https://www.cnblogs.com/linjiangxian/p/13203835.html

posted on 2021-04-18 11:52  sunylat  阅读(340)  评论(0编辑  收藏  举报