vue router 常用操作 重定向 redirect
1、重定向 redirectconst routes = [{ path: '/', redirect: '/index'},{ path: '/index', component: index }]2、嵌套路由const routes = [{ path: '/index', component: index,children: [...
·
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') }
]
更多推荐
已为社区贡献21条内容
所有评论(0)