-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
help 📝docsdocs
Description
如何在开发环境,生产环境访问后端接口
与 devServer 相关的问题请自行查询 API 文档,未给出链接的,请自行百度谷歌
基础知识须知
- Vue Cli3 devServer.proxy 配置参考
- Webpack devServer.proxy 配置参考
- Nginx/Apache 等 web 服务器反向代理
- CORS 跨域问题
开发环境采用 Webpack
的 devServer
Cli3 配置
devServer: {
proxy: {
'/api': {
target: 'http://localhost:8080/api',
ws: false,
changeOrigin: true,
pathRewrite: {
'^/api': ''
}
},
'/api/xxxx': {
target: 'http://localhost:8080/api',
ws: false,
changeOrigin: true,
pathRewrite: {
'^/api': ''
}
}
}
也可以参考 Github 上其他开源者的 devServer 配置项
ref https://github.com/PanJiaChen/vue-element-admin/blob/master/vue.config.js
生产环境
参考 Issue #41
Pro 官方文档
参考文档 https://pro.antdv.com/docs/deploy
注: 请不要在本 Issue 提问
Metadata
Metadata
Assignees
Labels
help 📝docsdocs