问题遇到的现象和发生背景
我访问我的某篇博客,刷新页面后出现白屏问题,应该是我的配置不对
问题相关代码,请勿粘贴截图
vue路由配置:
{
path: '/blog/:id',
name: 'blog',
component: Blog,
meta: {
title: '博客'
}
运行结果及报错内容
正常访问:
参数可以正常识别
刷新页面后:
出现白屏,且参数被识别成了url路径
我想要达到的结果
刷新后正常访问
我访问我的某篇博客,刷新页面后出现白屏问题,应该是我的配置不对
vue路由配置:
{
path: '/blog/:id',
name: 'blog',
component: Blog,
meta: {
title: '博客'
}
正常访问:
刷新页面后:
刷新后正常访问
将publicPath:'./',改成publicPath:'/'可解决这个问题(猜测vue3的资源路径不在一起导致的,vue2的资源是在一起的)