vue-router 404页面配置

4,520 阅读1分钟
export const appRouter = [
   {
    path: '/router1',
    name: 'router1',
    redirect: '/router1/test1',
    component: router1,
    meta: { title: '路由1'},
    children: [
      { path: 'test1', name: 'test1', component: test1, meta: { title: '测试1' } }
    ]
  }, {
    path: '/*',
    name: 'error-404',
    meta: { title: '404-页面不存在' },
    component: errorPage404`
  }
 ]
  1. *通配符会匹配所有路由
  2. 当使用了通配符路由之后,路由一定要放在最后