Vue 路由跳转后刷新页面404

我的情景

// mode: 'history'
{
    
    
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    children: [{
    
    
      path: 'dashboard',
      name: 'Dashboard',
      component: () => import('@/views/dashboard/index'),
      meta: {
    
     title: 'Dashboard', icon: 'dashboard' }
    }]
  },

重定向到/dashboard路径后刷新页面发现404,找不到这个页面,而我的路由模式是history。

解决

路由配置mode: 'history’改为默认mode: ‘hash’。

参考

猜你喜欢

转载自blog.csdn.net/qq_40230735/article/details/129401438