json 这么麻烦

This commit is contained in:
2025-11-06 20:59:18 +08:00
parent a0503d575e
commit aa3431856b
6 changed files with 354 additions and 26 deletions
+11
View File
@@ -17,4 +17,15 @@ export default defineConfig({
outDir: '../../backend/dist', // 默认是 'dist',可以修改为你想要的目录名
assetsDir: 'assets', // 静态资源目录(相对于 outDir)
},
server: {
proxy: {
'/api': {
target: 'http://127.0.0.1:8080',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '/api'), // 如果需要重写路径
// 如果后端接口没有 /api 前缀,可以这样写:
// rewrite: (path) => path.replace(/^\/api/, '')
},
},
},
})