stu_fms_ui/vue.config.js

24 lines
820 B
JavaScript
Raw Permalink Normal View History

2022-03-04 17:44:26 +08:00
const proxy = require('http-proxy-middleware');
module.exports = {
lintOnSave: false, // 关闭lint检查
// host: '0.0.0.0'
// 解决跨域
devServer: {
host: '127.0.0.1', // can be overwritten by process.env.HOST
port: 9080,
proxy: {
'/api': {//代理器中设置/api,项目中请求路径为/api的替换为target
// target: 'http://localhost:8082',
target: 'http://192.168.2.105:8082',//代理地址会代替axios中的baseUrl
secure: false, // 使用的是http协议则设置为falsehttps协议则设置为true
changOrigin: true, // 跨域
ws: true,
pathRewrite: {//重写url
'^/api': '/'
},
}
}
}
}