File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change
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 >
Original file line number Diff line number Diff line change 1
1
import { createRouter , createWebHistory } from 'vue-router' ;
2
2
import Home from '../pages/index.vue' ;
3
3
import Todos from '../pages/todos/index.vue' ;
4
+ import Todo from '../pages/todos/_id.vue' ;
4
5
5
6
const router = createRouter ( {
6
7
history : createWebHistory ( ) ,
@@ -14,6 +15,11 @@ const router = createRouter({
14
15
path : '/todos' ,
15
16
name : 'Todos' ,
16
17
component : Todos
18
+ } ,
19
+ {
20
+ path : '/todos/:id' ,
21
+ name : 'Todo' ,
22
+ component : Todo
17
23
}
18
24
]
19
25
} ) ;
You can’t perform that action at this time.
0 commit comments