// vue.config.js const path = require('path'); module.exports = { devServer: { proxy: { '/api': { target: 'http://localhost:8080', changeOrigin: true, pathRewrite: { '^/api': '' // 根据后端接口路径决定是否重写 }, secure: false, logLevel: 'debug' // 添加调试日志 } } } }