
正文
vue router 常用操作
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
1. 普通路由
const routes = [
{ path: '/index', component: index }
]
2. 重定向 redirect
const routes = [
{ path: '/', redirect: '/index'},
{ path: '/index', component: index }
]
3. 嵌套路由
const routes = [
{ path: '/index', component: index,
children: [
{ path: 'info', component: info}
]
}
]
4. 懒加载
const routes = [
{ path: '/index', component: () => import('@/views/index.vue')},
{ path: '/hello', component: () => import('@/views/hello.vue') }
]







