正确的配置方法: 正确的配置方法.png 遇到的问题是,在pathRewrite的设置中,写成了这样 pathRewrite: { '^/api':'' } 没有个api重写路径,导致请求的接口出错,所有的请求都是404。