Vue-router 中的 / 与 *

Vue-router 中的 / 与 *

const routes = [
  {
    path: '/',  // 是指 localhost:8080/
    redirect: '/index',
    component: () => import('@/layouts')
  },
  {
    path: '*', // 是指所有匹配不到的页面。比如下方的 /hello,能匹配到,就不会进这个
    redirect: '/404'
  },
  {
    path: '/hello',
    component: () => import('@/layouts')
  },
  {
    path: '/404',
    component: () => import('@/views/404'),
    meta: { title: '404' }
  }
]
posted @ 2022-09-14 09:19  朱在春  阅读(100)  评论(0编辑  收藏  举报