Vue运行错误: Duplicate keys detected: '/'. This may cause an update error.
Vue运行错误: Duplicate keys detected: ‘/’. This may cause an update error.配置路由权限的时候遇到 vue 一个问题,这里记录一下。检测到重复键,导致更新失败主要原因是因为:key=‘data.path’,这里的 data 有问题,下面的path都用了‘/’ 所以导致跟新失败data 的值如下export const co...
   ·  
 配置路由权限的时候遇到 vue 一个问题,这里记录一下。
  检测到重复键,导致更新失败
  主要原因是因为:key=‘data.path’,这里的 data 有问题,
  下面的path都用了‘/’ 所以导致跟新失败
  data 的值如下
export const constantRoutes = [{
    path: '/login',
    component: () => import('@/views/login/index'),
    hidden: true
  },
  {
    path: '/404',
    component: () => import('@/views/error-page/404'),
    hidden: true
  },
  {
    path: '/401',
    component: () => import('@/views/error-page/401'),
    hidden: true
  },
  {
    path: '/',
    component: Layout,
    redirect: '/home',
    children: [{
      path: 'home',
      name: 'home',
      component: () => import('@/views/home/homePage'),
      meta: {
        title: '主页',
        icon: 'homePage',
        affix: true
      }
    }]
  }
]
export const asyncRoutes = [{
    path: '/',
    name: 'UserManage',
    component: Layout,
    meta: {
      title: 'UserManage',
      icon: 'lock',
      roles: ['admin'] 
    },
    children: [{
      path: '/UserManage',
      name: 'UserManage',
      component: () =>
        import('../views/user/UserManage.vue'),
      meta: {
        title: '用户管理',
        icon: 'lock',
        roles: ['editor'] 
      }
    }]
  },
  {
    path: '*',
    redirect: '/404',
    hidden: true
  }
]
更多推荐
 
 



所有评论(0)