stu_fms_ui/vue.config.js

24 lines
820 B
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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': '/'
},
}
}
}
}