- 在根路由下添加 redirect 属性,重定向到 /home - 新增 home子路由,路径为 /home- 使用异步加载方式引入 home 组件
@@ -8,6 +8,14 @@ const router = createRouter({
path: '/',
name: 'layout',
component: () => import('@/layout/index.vue'),
+ redirect: '/home',
+ children: [
+ {
+ path: 'home',
+ name: 'home',
+ component: () => import('@/views/home.vue'),
+ },
+ ],
},
{
path: '/NotFound404',