解决跨域

  • 例如项目在 http://127.0.0.1:8080端口下,而接口在 http://127.0.0.1:3000 端口不相同就会产生跨域问题。
    vue.config.js配置代理服务器 与 代理服务器与接口端口一致就解决了跨域。
  devServer: {
    proxy: 'http://localhost:3000'
  }
posted @ 2022-05-04 23:28  HuangBingQuan  阅读(73)  评论(0编辑  收藏  举报