init
This commit is contained in:
17
vue.config.js
Normal file
17
vue.config.js
Normal file
@@ -0,0 +1,17 @@
|
||||
// 配置解决跨域问题
|
||||
module.exports = {
|
||||
devServer:{
|
||||
host:'localhost',//指定开发服务器主机地址
|
||||
port:8088,//设置前端项目端口号为8088
|
||||
open:true,//启动时自动打开浏览器
|
||||
proxy:{//配置代理解决跨域问题
|
||||
[process.env.VUE_APP_BASE_API]:{//环境变量定义代理路径前缀
|
||||
target: 'http://192.168.0.10:8000',//后端项目真实地址
|
||||
changeOrigin:true,//开启origin伪装,绕过跨域限制
|
||||
pathRewrite: {//路径重写规则
|
||||
['^' + process.env.VUE_APP_BASE_API]: ''//去除请求路径中的代理前缀
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user