0%

解决 vue3 打包后页面空白的问题

设置路由模式为 hash

1
2
3
4
const router = Router.createRouter({
history: Router.createWebHashHistory(process.env.BASE_URL),
routes: routes,
});

在 package.json 同级目录下可以找到一个 vue.config.js 文件(如果没有就自己创建一个), 加入下面的代码

1
2
3
module.exports = {
publicPath: './',
}

参考 https://blog.csdn.net/qq_48960335/article/details/123928104

history 模式下无法使用子路由———暂未找到解决方案

欢迎关注我的其它发布渠道