客户端代理方式 解决CORS跨域问题和统一API域名请求
打开 vite.config.js ,配置端口和代理
//解决CORS跨域问题和统一API域名请求
server: {
host: '127.0.0.1',
port: 3001,//Vue启动端口地址,设置后需要重新编译Vue
open: true,//编译后自动打开浏览器
proxy: {
'/api': {
target: 'http://localhost:57679/',//api地址
changeOrigin: true,
},
},
},
浙公网安备 33010602011771号