新建 vue.config.js 文件 // 在这里配置 module.exports = { // 基本路径 publicPath:"./", // 输出文件目录 outputDir: 'dist', // webpack-dev-server 相关配置 devServer: { // port: 8888, // ... }, } 在 router.js 里 //把mode写成hash模式 mode: 'hash' 运行 npm run build