1、路由的重定向 以及 二级路由的嵌套
const routes = [
// 路由的重定向
{
path: "/",
redirect: "/home/index",
},
{
path: "/home",
name: "home",
component: HomeView,
// 二级路由的嵌套
children: [
{
path: "index",
name: "/home/index",
component: () => import("../views/index.vue"),
},
{
path: "actor-list",
name: "/home/actor-list",
component: () => import("../views/actor/ActorList.vue"),
},
{
path: "actor-add",
name: "/home/actor-add",
component: () => import("../views/actor/ActorAdd.vue"),
},
],
},
{
path: "/about",
name: "about",
// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () =>
import(/* webpackChunkName: "about" */ "../views/AboutView.vue"),
},
];
2、二级路由占位符