質問編集履歴

2

質問に応じて内容の修正。(index.jsの追加)

2023/07/26 05:01

投稿

ksoto
ksoto

スコア12

test CHANGED
File without changes
test CHANGED
@@ -39,6 +39,52 @@
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'
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
+ })
83
+
84
+ export default router
85
+
86
+ ```
87
+
42
88
 
43
89
 
44
90
  ### 補足情報(FW/ツールのバージョンなど)

1

誤字の修正

2023/07/25 12:07

投稿

ksoto
ksoto

スコア12

test CHANGED
@@ -1 +1 @@
1
- Vue3でVieRouterを使用して子コンポーネントを切り替える方法
1
+ Vue3でVueRouterを使用して子コンポーネントを切り替える方法
test CHANGED
File without changes