1
0
forked from qq1244/vue-beta

主要改了路径,还有vite.config.ts配置后端链接

This commit is contained in:
zzz
2025-06-20 23:26:03 +08:00
parent 3507ba4822
commit 65eb226bd8
20 changed files with 32 additions and 21 deletions

View File

@@ -15,4 +15,18 @@ export default defineConfig({
'@': fileURLToPath(new URL('./src', import.meta.url))
},
},
})
server: {
host: '0.0.0.0', // 允许局域网访问(可选)
port: 5173, // 修改端口号(默认是 5173
open: true, // 启动项目时自动打开浏览器
// 配置代理解决跨域问题
proxy: {
'/api': { // 以/api开头的请求会被代理
target: 'http://localhost:8080', // 目标后端服务器地址如Spring Boot服务
changeOrigin: true, // 开启跨域请求头中的host会被设置成target
rewrite: path => path.replace(/^\/api/, '') // 重写路径,去掉开头的/api
}
}
}
})