File tree Expand file tree Collapse file tree 5 files changed +57
-27
lines changed Expand file tree Collapse file tree 5 files changed +57
-27
lines changed Original file line number Diff line number Diff line change 64
64
"subject" : " new todo222" ,
65
65
"completed" : true ,
66
66
"id" : 21
67
- },
68
- {
69
- "subject" : " buy milk" ,
70
- "completed" : false ,
71
- "body" : " go to supermarket and buy milk" ,
72
- "id" : 22
73
67
}
74
68
]
75
69
}
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <Modal >
3
+ <template v-slot :title >
4
+ Delete Todo
5
+ </template >
6
+ <template v-slot :body >
7
+ Are you sure you want to delete this todo?
8
+ </template >
9
+ <template v-slot :footer >
10
+ <button
11
+ type =" button"
12
+ class =" btn btn-secondary"
13
+ @click =" onClose"
14
+ >
15
+ Close
16
+ </button >
17
+ <button
18
+ type =" button"
19
+ class =" btn btn-danger"
20
+ @click =" onDelete"
21
+ >Delete</button >
22
+ </template >
23
+ </Modal >
24
+ </template >
25
+
26
+ <script >
27
+ import Modal from ' @/components/Modal.vue' ;
28
+
29
+ export default {
30
+ components: {
31
+ Modal
32
+ },
33
+ setup (props , { emit }) {
34
+ const onClose = () => {
35
+ emit (' close' );
36
+ }
37
+
38
+ const onDelete = () => {
39
+ emit (' delete' );
40
+ }
41
+
42
+ return {
43
+ onClose,
44
+ onDelete
45
+ }
46
+ }
47
+ }
48
+ </script >
49
+
50
+ <style >
51
+
52
+ </style >
Original file line number Diff line number Diff line change 4
4
<div class =" modal-content" >
5
5
<div class =" modal-header" >
6
6
<h5 class =" modal-title" >
7
- Delete Todo
7
+ < slot name = " title " ></ slot >
8
8
</h5 >
9
9
<button type =" button" class =" close" >
10
10
<span @click =" onClose" >× ; </span >
11
11
</button >
12
12
</div >
13
13
<div class =" modal-body" >
14
- Are you sure you want to delete the todo?
14
+ < slot name = " body " ></ slot >
15
15
</div >
16
16
<div class =" modal-footer" >
17
- <button
18
- type =" button"
19
- class =" btn btn-secondary"
20
- @click =" onClose"
21
- >
22
- Close
23
- </button >
24
- <button
25
- type =" button"
26
- class =" btn btn-danger"
27
- @click =" onDelete"
28
- >Delete</button >
17
+ <slot name =" footer" ></slot >
29
18
</div >
30
19
</div >
31
20
</div >
@@ -38,14 +27,9 @@ export default {
38
27
const onClose = () => {
39
28
emit (' close' );
40
29
}
41
-
42
- const onDelete = () => {
43
- emit (' delete' );
44
- }
45
30
46
31
return {
47
32
onClose,
48
- onDelete
49
33
}
50
34
}
51
35
}
Original file line number Diff line number Diff line change 42
42
43
43
<script >
44
44
import { useRouter } from ' vue-router' ;
45
- import Modal from ' @/components/Modal .vue' ;
45
+ import Modal from ' @/components/DeleteModal .vue' ;
46
46
import { ref } from ' vue' ;
47
47
48
48
export default {
Original file line number Diff line number Diff line change 1
1
<template >
2
- <div style = " opacity : 0.5 " >
2
+ <div >
3
3
<div class =" d-flex justify-content-between mb-3" >
4
4
<h2 >To-Do List</h2 >
5
5
<button
You can’t perform that action at this time.
0 commit comments