Skip to content

Commit 4e78454

Browse files
Clone example
1 parent 82b2282 commit 4e78454

File tree

5 files changed

+121
-6
lines changed

5 files changed

+121
-6
lines changed

example/App.vue

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,17 @@
3232
>Two Lists</a>
3333
</li>
3434

35+
<li class="nav-item">
36+
<a
37+
class="nav-link"
38+
data-toggle="tab"
39+
href="#clone"
40+
role="tab"
41+
aria-controls="profile"
42+
aria-selected="false"
43+
>Clone</a>
44+
</li>
45+
3546
</ul>
3647
<div
3748
class="tab-content"
@@ -58,6 +69,16 @@
5869

5970
</div>
6071

72+
<div
73+
class="tab-pane show"
74+
id="clone"
75+
role="tabpanel"
76+
aria-labelledby="profile-tab"
77+
>
78+
<clone />
79+
80+
</div>
81+
6182

6283
</div>
6384
</div>
@@ -67,12 +88,14 @@
6788
<script>
6889
import simple from "./components/simple";
6990
import twoLists from "./components/two-lists";
91+
import clone from "./components/clone";
7092
7193
export default {
7294
name: "app",
7395
components: {
7496
simple,
75-
twoLists
97+
twoLists,
98+
clone
7699
}
77100
};
78101
</script>

example/components/clone.vue

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<template>
2+
3+
<div class=" justify-content-center jumbotron">
4+
5+
<div class="row">
6+
<div class="col-3">
7+
<h3>Draggable for list 1</h3>
8+
<draggable
9+
class="dragArea list-group"
10+
:list="list1"
11+
:options="{group:{name:'people', pull:'clone', put:false }}"
12+
@change="log"
13+
>
14+
<div
15+
class="list-group-item"
16+
v-for="(element, index) in list1"
17+
:key="element.name"
18+
>
19+
{{element.name}} {{index}}
20+
</div>
21+
</draggable>
22+
</div>
23+
24+
<div class="col-3">
25+
<h3>Draggable for list 2</h3>
26+
<draggable
27+
class="dragArea list-group"
28+
:list="list2"
29+
:options="{group:'people'}"
30+
@change="log"
31+
>
32+
<div
33+
class="list-group-item"
34+
v-for="(element, index) in list2"
35+
:key="element.name"
36+
>
37+
{{element.name}} {{index}}
38+
</div>
39+
</draggable>
40+
</div>
41+
42+
<rawDisplayer
43+
class="col-3"
44+
:value="list1"
45+
title="List 1"
46+
/>
47+
48+
<rawDisplayer
49+
class="col-3"
50+
:value="list2"
51+
title="List 2"
52+
/>
53+
54+
</div>
55+
56+
</div>
57+
</template>
58+
59+
<script>
60+
import draggable from "@/components/Vuedraggable";
61+
import rawDisplayer from "./raw-displayer.vue";
62+
let id = 1;
63+
export default {
64+
name: "clone",
65+
components: {
66+
draggable,
67+
rawDisplayer
68+
},
69+
data() {
70+
return {
71+
list1: [
72+
{ name: "John", id: 1 },
73+
{ name: "Joao", id: 2 },
74+
{ name: "Jean", id: 3 },
75+
{ name: "Gerard", id: 4 }
76+
],
77+
list2: [
78+
{ name: "Juan", id: 5 },
79+
{ name: "Edgard", id: 6 },
80+
{ name: "Johnson", id: 7 }
81+
]
82+
};
83+
},
84+
methods: {
85+
log: function(evt) {
86+
console.log(evt);
87+
}
88+
}
89+
};
90+
</script>
91+
<style scoped>
92+
</style>
93+

example/components/raw-displayer.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
</template>
77
<script>
88
const props = {
9+
name: "raw-displayer",
910
title: {
1011
required: true,
1112
type: String

example/components/simple.vue

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
2-
<div>
3-
<div class="row justify-content-center jumbotron">
2+
<div class="justify-content-center jumbotron">
3+
<div class="row">
44

55
<div class="col-2">
66
<div
@@ -71,9 +71,6 @@ export default {
7171
computed: {
7272
draggingInfo() {
7373
return this.dragging ? "under drag" : "";
74-
},
75-
listString() {
76-
return JSON.stringify(this.list, null, 2);
7774
}
7875
},
7976
methods: {

example/components/two-lists.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ import draggable from "@/components/Vuedraggable";
6060
import rawDisplayer from "./raw-displayer.vue";
6161
6262
export default {
63+
name: "two-lists",
6364
components: {
6465
draggable,
6566
rawDisplayer

0 commit comments

Comments
 (0)