Sfoglia il codice sorgente

feat(router): 添加首页路由并设置重定向

- 在根路由下添加 redirect 属性,重定向到 /home
- 新增 home子路由,路径为 /home- 使用异步加载方式引入 home 组件
nahida 10 mesi fa
parent
commit
5c3c02aa60
1 ha cambiato i file con 8 aggiunte e 0 eliminazioni
  1. 8 0
      src/router/index.ts

+ 8 - 0
src/router/index.ts

@@ -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',