Skip to content

Commit cb6553d

Browse files
committed
45
1 parent 12214d0 commit cb6553d

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/pages/todos/_id.vue

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<template>
2+
<div>Todo Page</div>
3+
</template>
4+
5+
<script>
6+
import { useRoute } from 'vue-router';
7+
8+
export default {
9+
setup() {
10+
const route = useRoute();
11+
12+
console.log(route.params.id);
13+
}
14+
}
15+
</script>
16+
17+
<style>
18+
19+
</style>

src/router/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { createRouter, createWebHistory } from 'vue-router';
22
import Home from '../pages/index.vue';
33
import Todos from '../pages/todos/index.vue';
4+
import Todo from '../pages/todos/_id.vue';
45

56
const router = createRouter({
67
history: createWebHistory(),
@@ -14,6 +15,11 @@ const router = createRouter({
1415
path: '/todos',
1516
name: 'Todos',
1617
component: Todos
18+
},
19+
{
20+
path: '/todos/:id',
21+
name: 'Todo',
22+
component: Todo
1723
}
1824
]
1925
});

0 commit comments

Comments
 (0)