File tree Expand file tree Collapse file tree 4 files changed +124
-13
lines changed Expand file tree Collapse file tree 4 files changed +124
-13
lines changed Original file line number Diff line number Diff line change 42
42
>Clone</a >
43
43
</li >
44
44
45
+ <li class =" nav-item" >
46
+ <a
47
+ class =" nav-link"
48
+ data-toggle =" tab"
49
+ href =" #custom-clone"
50
+ role =" tab"
51
+ aria-controls =" profile"
52
+ aria-selected =" false"
53
+ >Custom Clone</a >
54
+ </li >
55
+
45
56
<li class =" nav-item" >
46
57
<a
47
58
class =" nav-link"
129
140
<clone />
130
141
</div >
131
142
143
+ <div
144
+ class =" tab-pane show"
145
+ id =" custom-clone"
146
+ role =" tabpanel"
147
+ aria-labelledby =" profile-tab"
148
+ >
149
+ <custom-clone />
150
+ </div >
151
+
132
152
<div
133
153
class =" tab-pane show"
134
154
id =" footerslot"
182
202
import simple from " ./components/simple" ;
183
203
import twoLists from " ./components/two-lists" ;
184
204
import clone from " ./components/clone" ;
205
+ import customClone from " ./components/custom-clone" ;
185
206
import footerslot from " ./components/footerslot" ;
186
207
import headerslot from " ./components/headerslot" ;
187
208
import handler from " ./components/handler" ;
@@ -194,6 +215,7 @@ export default {
194
215
simple,
195
216
twoLists,
196
217
clone,
218
+ customClone,
197
219
footerslot,
198
220
headerslot,
199
221
handler,
Original file line number Diff line number Diff line change 2
2
<div class =" justify-content-center jumbotron" >
3
3
<div class =" row" >
4
4
<div class =" col-3" >
5
- <h3 >Draggable for list 1</h3 >
5
+ <h3 >Draggable 1</h3 >
6
6
<draggable
7
7
class =" dragArea list-group"
8
8
:list =" list1"
14
14
v-for =" (element, index) in list1"
15
15
:key =" element.name"
16
16
>
17
- {{ element.name }} {{ index }}
17
+ {{ element.name }}
18
18
</div >
19
19
</draggable >
20
20
</div >
21
21
22
22
<div class =" col-3" >
23
- <h3 >Draggable for list 2</h3 >
23
+ <h3 >Draggable 2</h3 >
24
24
<draggable
25
25
class =" dragArea list-group"
26
26
:list =" list2"
32
32
v-for =" (element, index) in list2"
33
33
:key =" element.name"
34
34
>
35
- {{ element.name }} {{ index }}
35
+ {{ element.name }}
36
36
</div >
37
37
</draggable >
38
38
</div >
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <div class =" justify-content-center jumbotron" >
3
+ <div class =" row" >
4
+ <div class =" col-3" >
5
+ <h3 >Draggable 1</h3 >
6
+ <draggable
7
+ class =" dragArea list-group"
8
+ :list =" list1"
9
+ :options =" { group: { name: 'people', pull: 'clone', put: false} }"
10
+ :clone =" cloneDog"
11
+ @change =" log"
12
+ >
13
+ <div
14
+ class =" list-group-item"
15
+ v-for =" (element, index) in list1"
16
+ :key =" element.id"
17
+ >
18
+ {{ element.name }}
19
+ </div >
20
+ </draggable >
21
+ </div >
22
+
23
+ <div class =" col-3" >
24
+ <h3 >Draggable 2</h3 >
25
+ <draggable
26
+ class =" dragArea list-group"
27
+ :list =" list2"
28
+ :options =" { group: 'people' }"
29
+ @change =" log"
30
+ >
31
+ <div
32
+ class =" list-group-item"
33
+ v-for =" (element, index) in list2"
34
+ :key =" element.id"
35
+ >
36
+ {{ element.name }}
37
+ </div >
38
+ </draggable >
39
+ </div >
40
+
41
+ <rawDisplayer
42
+ class =" col-3"
43
+ :value =" list1"
44
+ title =" List 1"
45
+ />
46
+
47
+ <rawDisplayer
48
+ class =" col-3"
49
+ :value =" list2"
50
+ title =" List 2"
51
+ />
52
+ </div >
53
+ </div >
54
+ </template >
55
+
56
+ <script >
57
+ import draggable from " @/vuedraggable" ;
58
+ import rawDisplayer from " ./raw-displayer.vue" ;
59
+ let idGlobal = 8 ;
60
+ export default {
61
+ name: " clone" ,
62
+ components: {
63
+ draggable,
64
+ rawDisplayer
65
+ },
66
+ data () {
67
+ return {
68
+ list1: [
69
+ { name: " dog 1" , id: 1 },
70
+ { name: " dog 2" , id: 2 },
71
+ { name: " dog 3" , id: 3 },
72
+ { name: " dog 4" , id: 4 }
73
+ ],
74
+ list2: [
75
+ { name: " cat 5" , id: 5 },
76
+ { name: " cat 6" , id: 6 },
77
+ { name: " cat 7" , id: 7 }
78
+ ]
79
+ };
80
+ },
81
+ methods: {
82
+ log : function (evt ) {
83
+ window .console .log (evt);
84
+ },
85
+ cloneDog ({ id }) {
86
+ return {
87
+ id: idGlobal++ ,
88
+ name: ` cat ${ id} `
89
+ };
90
+ }
91
+ }
92
+ };
93
+ </script >
94
+ <style scoped></style >
Original file line number Diff line number Diff line change 2
2
<div class =" justify-content-center jumbotron" >
3
3
<div class =" row" >
4
4
<div class =" col-3" >
5
- <h3 >Draggable for list 1</h3 >
5
+ <h3 >Draggable 1</h3 >
6
6
<draggable
7
- class =" dragArea list-group"
7
+ class =" list-group"
8
8
:list =" list1"
9
9
:options =" { group: 'people' }"
10
10
@change =" log"
20
20
</div >
21
21
22
22
<div class =" col-3" >
23
- <h3 >Draggable for list 2</h3 >
23
+ <h3 >Draggable 2</h3 >
24
24
<draggable
25
- class =" dragArea list-group"
25
+ class =" list-group"
26
26
:list =" list2"
27
27
:options =" { group: 'people' }"
28
28
@change =" log"
@@ -86,8 +86,3 @@ export default {
86
86
}
87
87
};
88
88
</script >
89
- <style >
90
- .dragArea {
91
- min-height : 10px ;
92
- }
93
- </style >
You can’t perform that action at this time.
0 commit comments