vue 配置
vue.config.js
devServer: {
// open: process.platform === 'darwin',
//将服务启动后默认打开浏览器
open: true,
// host: '192.168.0.224',
port: 8080,
https: true, //nginx代理https需要开启
hotOnly: false,
proxy: {
// 设置代理
'/api': {
target: 'http://192.168.0.125:8001',
changeOrigin: true,
pathRewrite: {
'^/api': '' //将 /api 替换成空字符串 确保匹配到正确的接口
}
},
'/fanyi': {
target: 'https://fanyi-api.baidu.com/api/trans/vip/translate',
secure: true, // 如果是https接口,需要配置这个参数
changeOrigin: true,
pathRewrite: {
'^/fanyi':