需要配置文件vue.config.js
module.exports = {
devServer: {
host: 'localhost',
port: '8080',
proxy: {
"/capi": {
target: '你要代理的地址',
changeOringin: true,
pathRewrite: {
"^/capi": ""
}
}
}
}
}