配置请求域名,有umirc.ts文件可以直接在该文件加

proxy: {
    '/api': {   // 检测域名后面带 /api/ 的路径
      target: 'http://192.168.0.90',   // 要请求的域名或IP地址
      'changeOrigin': true,
      // 'pathRewrite': { '^/api' : '' },
        // 把域名后面的 /api 去掉
    },
  },
 
自行配置根目录下,config目录添加config.ts文件,并删除umirc.ts文件,生效。
Posted on 2023-05-05 11:14  博客sl  阅读(14)  评论(0编辑  收藏  举报