其他分享
首页 > 其他分享> > Vue2:注册子路由

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"),
    }
]

 

标签:index,vue,Vue2,..,views,component,a1,注册,路由
来源: https://www.cnblogs.com/LIXI-/p/16676221.html