1、重定向 redirect
const routes = [
{ path: '/', redirect: '/index'},
{ path: '/index', component: index }
]
2、嵌套路由
const routes = [
{ path: '/index', component: index,
children: [
{ path: 'info', component: info}
]
}
]
通过/index/info就可以访问到info组件了
3、懒加载
const routes = [
{ path: '/index', component: () => import('@/views/index.vue')},
{ path: '/hello', component: () => import('@/views/hello.vue') }
]
本文详细介绍了Vue中三种常见的路由配置方式:重定向、嵌套路由和懒加载。重定向用于将一个路径重映射到另一个路径,嵌套路由实现子路由的配置,而懒加载则提高了应用的加载速度和性能。
1313





