File tree Expand file tree Collapse file tree 4 files changed +26
-7
lines changed Expand file tree Collapse file tree 4 files changed +26
-7
lines changed Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div class =" justify-content-center jumbotron" >
3
3
<div class =" row" >
4
- <div class =" col-8" >
4
+ <div class =" col-1" >
5
+ <button class =" btn btn-secondary button" @click =" add" >Add</button >
6
+ </div >
7
+
8
+ <div class =" col-7" >
5
9
<h3 >Draggable {{ draggingInfo }}</h3 >
6
10
7
11
<draggable
12
16
>
13
17
<li
14
18
class =" list-group-item"
15
- v-for =" element in list"
19
+ v-for =" ( element, idx) in list"
16
20
:key =" element.name"
17
21
>
18
22
<i class =" fa fa-align-justify handle" ></i >
19
23
20
24
{{ element.name }}
25
+
26
+ <i class =" fa fa-times close" @click =" removeAt(idx)" ></i >
21
27
</li >
22
28
</draggable >
23
29
</div >
28
34
</template >
29
35
30
36
<script >
37
+ let id = 3 ;
31
38
import draggable from " @/vuedraggable" ;
32
39
import rawDisplayer from " ./raw-displayer.vue" ;
33
40
export default {
@@ -50,14 +57,26 @@ export default {
50
57
draggingInfo () {
51
58
return this .dragging ? " under drag" : " " ;
52
59
}
60
+ },
61
+ methods: {
62
+ removeAt (idx ) {
63
+ this .list .splice (idx, 1 );
64
+ },
65
+ add : function () {
66
+ id++ ;
67
+ this .list .push ({ name: " Juan " + id, id });
68
+ }
53
69
}
54
70
};
55
71
</script >
56
72
<style scoped>
57
- .buttons {
58
- margin-top : 50 px ;
73
+ .button {
74
+ margin-top : 35 px ;
59
75
}
60
76
.handle {
61
77
float : left ;
62
78
}
79
+ .close {
80
+ float : right ;
81
+ }
63
82
</style >
Original file line number Diff line number Diff line change @@ -73,6 +73,6 @@ export default {
73
73
</script >
74
74
<style scoped>
75
75
.buttons {
76
- margin-top : 50 px ;
76
+ margin-top : 35 px ;
77
77
}
78
78
</style >
Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ export default {
93
93
94
94
<style >
95
95
.button {
96
- margin-top : 50 px ;
96
+ margin-top : 35 px ;
97
97
}
98
98
99
99
.flip-list-move {
Original file line number Diff line number Diff line change @@ -89,7 +89,7 @@ export default {
89
89
90
90
<style >
91
91
.button {
92
- margin-top : 50 px ;
92
+ margin-top : 35 px ;
93
93
}
94
94
95
95
.flip-list-move {
You can’t perform that action at this time.
0 commit comments