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') }
]

 

posted @ 2019-10-06 15:11  猪脚踏浪  阅读(193)  评论(0编辑  收藏  举报