質問編集履歴
2
質問に応じて内容の修正。(index.jsの追加)
    
        title	
    CHANGED
    
    | 
            File without changes
         | 
    
        body	
    CHANGED
    
    | @@ -39,8 +39,54 @@ | |
| 39 39 | 
             
            </template>
         | 
| 40 40 | 
             
            ```
         | 
| 41 41 |  | 
| 42 | 
            +
            ```index.js
         | 
| 43 | 
            +
            import { createRouter, createWebHistory } from 'vue-router'
         | 
| 44 | 
            +
            import HomeView from '../views/HomeView.vue'
         | 
| 45 | 
            +
            import Select from '../views/return/SelectReturnBook.vue'
         | 
| 42 46 |  | 
| 47 | 
            +
            const router = createRouter({
         | 
| 48 | 
            +
              history: createWebHistory(import.meta.env.BASE_URL),
         | 
| 49 | 
            +
              routes: [
         | 
| 50 | 
            +
                {
         | 
| 51 | 
            +
                  path: '/',
         | 
| 52 | 
            +
                  name: 'home',
         | 
| 53 | 
            +
                  component: HomeView
         | 
| 54 | 
            +
                },
         | 
| 55 | 
            +
                {
         | 
| 56 | 
            +
                  path: '/parent',
         | 
| 57 | 
            +
                  name: 'parent',
         | 
| 58 | 
            +
                  component: () => import('../views/Parent.vue'),
         | 
| 59 | 
            +
                  children: [
         | 
| 60 | 
            +
                    {
         | 
| 61 | 
            +
                      path: '',
         | 
| 62 | 
            +
                      component: () => import('../views/Child1.vue')
         | 
| 63 | 
            +
                    },
         | 
| 64 | 
            +
                    {
         | 
| 65 | 
            +
                      path: 'child2',
         | 
| 66 | 
            +
                      component: () => import('../views/Child2.vue')
         | 
| 67 | 
            +
                    }
         | 
| 68 | 
            +
                  ]
         | 
| 69 | 
            +
                },
         | 
| 70 | 
            +
                {
         | 
| 71 | 
            +
                  path: '/child1,
         | 
| 72 | 
            +
                  name: 'child1',
         | 
| 73 | 
            +
                  component: () => import('../views/Child1.vue'),
         | 
| 74 | 
            +
                },
         | 
| 75 | 
            +
              
         | 
| 76 | 
            +
                {
         | 
| 77 | 
            +
                  path: '/child2',
         | 
| 78 | 
            +
                  name: 'child2',
         | 
| 79 | 
            +
                  component: () => import('../views/Child2.vue')
         | 
| 80 | 
            +
                }
         | 
| 81 | 
            +
              ]
         | 
| 82 | 
            +
            })
         | 
| 43 83 |  | 
| 84 | 
            +
            export default router
         | 
| 85 | 
            +
             | 
| 86 | 
            +
            ```
         | 
| 87 | 
            +
             | 
| 88 | 
            +
             | 
| 89 | 
            +
             | 
| 44 90 | 
             
            ### 補足情報(FW/ツールのバージョンなど)
         | 
| 45 91 |  | 
| 46 92 | 
             
            Vue3です
         | 
1
誤字の修正
    
        title	
    CHANGED
    
    | @@ -1,1 +1,1 @@ | |
| 1 | 
            -
            Vue3で | 
| 1 | 
            +
            Vue3でVueRouterを使用して子コンポーネントを切り替える方法
         | 
    
        body	
    CHANGED
    
    | 
            File without changes
         | 
