Vue2:注册子路由

 

const routes = [    {
        path: '/a',
        name: 'a',
        component: () => import("../views/a/index.vue"),
        redirect: "/a/a1", //用输入的是/a路由  帮他重定向到 /a/a1
        children: [{
                path: "a1",
                name: "a1",
                component: () => import("../views/a/views/a1/index.vue")
            },
            {
                path: "/*",
                component: () => import("../views/a/views/a1/index.vue")
            }
        ]
    },
    {
        path: '/*',
        component: () => import("../views/err/index.vue"),
    }
]

 

posted on 2022-09-10 11:21  香香鲲  阅读(100)  评论(0编辑  收藏  举报