-
Notifications
You must be signed in to change notification settings - Fork 546
/
Copy pathheaderslot.vue
71 lines (66 loc) · 1.56 KB
/
headerslot.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<template>
<div class="row">
<div class="col-8">
<h3>Draggable with header</h3>
<draggable
:list="list"
class="list-group"
@start="dragging = true"
@end="dragging = false"
@change="log"
item-key="name"
>
<template #header>
<div class="btn-group list-group-item" role="group">
<button class="btn btn-secondary" @click="add">Add</button>
</div>
</template>
<template #footer>
<div class="btn-group list-group-item" role="group">
<button class="btn btn-secondary" @click="replace">Replace</button>
</div>
</template>
<template #item="{ element }">
<div class="list-group-item item">
{{ element.name }}
</div>
</template>
</draggable>
</div>
<rawDisplayer class="col-3" :value="list" title="List" />
</div>
</template>
<script>
import draggable from "@/vuedraggable";
let id = 1;
export default {
name: "headerslot",
display: "Header slot",
order: 13,
components: {
draggable
},
data() {
return {
list: [
{ name: "John 1", id: 0 },
{ name: "Joao 2", id: 1 },
{ name: "Jean 3", id: 2 }
],
dragging: false
};
},
methods: {
add: function() {
this.list.push({ name: "Juan " + id, id: id++ });
},
replace: function() {
this.list = [{ name: "Edgard", id: id++ }];
},
log: function(evt) {
window.console.log(evt);
}
}
};
</script>
<style scoped></style>