Skip to content

Commit

Permalink
Clone example
Browse files Browse the repository at this point in the history
  • Loading branch information
David-Desmaisons committed Feb 20, 2019
1 parent 82b2282 commit 4e78454
Show file tree
Hide file tree
Showing 5 changed files with 121 additions and 6 deletions.
25 changes: 24 additions & 1 deletion example/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@
>Two Lists</a>
</li>

<li class="nav-item">
<a
class="nav-link"
data-toggle="tab"
href="#clone"
role="tab"
aria-controls="profile"
aria-selected="false"
>Clone</a>
</li>

</ul>
<div
class="tab-content"
Expand All @@ -58,6 +69,16 @@

</div>

<div
class="tab-pane show"
id="clone"
role="tabpanel"
aria-labelledby="profile-tab"
>
<clone />

</div>


</div>
</div>
Expand All @@ -67,12 +88,14 @@
<script>
import simple from "./components/simple";
import twoLists from "./components/two-lists";
import clone from "./components/clone";
export default {
name: "app",
components: {
simple,
twoLists
twoLists,
clone
}
};
</script>
Expand Down
93 changes: 93 additions & 0 deletions example/components/clone.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<template>

<div class=" justify-content-center jumbotron">

<div class="row">
<div class="col-3">
<h3>Draggable for list 1</h3>
<draggable
class="dragArea list-group"
:list="list1"
:options="{group:{name:'people', pull:'clone', put:false }}"
@change="log"
>
<div
class="list-group-item"
v-for="(element, index) in list1"
:key="element.name"
>
{{element.name}} {{index}}
</div>
</draggable>
</div>

<div class="col-3">
<h3>Draggable for list 2</h3>
<draggable
class="dragArea list-group"
:list="list2"
:options="{group:'people'}"
@change="log"
>
<div
class="list-group-item"
v-for="(element, index) in list2"
:key="element.name"
>
{{element.name}} {{index}}
</div>
</draggable>
</div>

<rawDisplayer
class="col-3"
:value="list1"
title="List 1"
/>

<rawDisplayer
class="col-3"
:value="list2"
title="List 2"
/>

</div>

</div>
</template>

<script>
import draggable from "@/components/Vuedraggable";
import rawDisplayer from "./raw-displayer.vue";
let id = 1;
export default {
name: "clone",
components: {
draggable,
rawDisplayer
},
data() {
return {
list1: [
{ name: "John", id: 1 },
{ name: "Joao", id: 2 },
{ name: "Jean", id: 3 },
{ name: "Gerard", id: 4 }
],
list2: [
{ name: "Juan", id: 5 },
{ name: "Edgard", id: 6 },
{ name: "Johnson", id: 7 }
]
};
},
methods: {
log: function(evt) {
console.log(evt);
}
}
};
</script>
<style scoped>
</style>

1 change: 1 addition & 0 deletions example/components/raw-displayer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
</template>
<script>
const props = {
name: "raw-displayer",
title: {
required: true,
type: String
Expand Down
7 changes: 2 additions & 5 deletions example/components/simple.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div>
<div class="row justify-content-center jumbotron">
<div class="justify-content-center jumbotron">
<div class="row">

<div class="col-2">
<div
Expand Down Expand Up @@ -71,9 +71,6 @@ export default {
computed: {
draggingInfo() {
return this.dragging ? "under drag" : "";
},
listString() {
return JSON.stringify(this.list, null, 2);
}
},
methods: {
Expand Down
1 change: 1 addition & 0 deletions example/components/two-lists.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ import draggable from "@/components/Vuedraggable";
import rawDisplayer from "./raw-displayer.vue";
export default {
name: "two-lists",
components: {
draggable,
rawDisplayer
Expand Down

0 comments on commit 4e78454

Please sign in to comment.