配置代理

配置文件: vue.config.js

  1. devServer: {
  2. "proxy": {
  3. 'api': {
  4. target: "代理地址",
  5. pathRewrite: {
  6. '^/api': ''
  7. }
  8. }
  9. }
  10. }