-
Notifications
You must be signed in to change notification settings - Fork 546
/
Copy pathtable-column-example.vue
57 lines (53 loc) · 1.33 KB
/
table-column-example.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
<template>
<div class="row">
<div class="col-8">
<h3>Draggable table</h3>
<table class="table table-striped">
<thead class="thead-dark">
<draggable v-model="headers" tag="tr" :item-key="key => key">
<template #item="{ element: header }">
<th scope="col">
{{ header }}
</th>
</template>
</draggable>
</thead>
<tbody>
<tr v-for="item in list" :key="item.name">
<td v-for="header in headers" :key="header">{{ item[header] }}</td>
</tr>
</tbody>
</table>
</div>
<rawDisplayer class="col-2" :value="list" title="List" />
<rawDisplayer class="col-2" :value="headers" title="Headers" />
</div>
</template>
<script>
import draggable from "@/vuedraggable";
export default {
name: "table-column-example",
display: "Table Column",
order: 9,
components: {
draggable
},
data() {
return {
headers: ["id", "name", "sport"],
list: [
{ id: 1, name: "Abby", sport: "basket" },
{ id: 2, name: "Brooke", sport: "foot" },
{ id: 3, name: "Courtenay", sport: "volley" },
{ id: 4, name: "David", sport: "rugby" }
],
dragging: false
};
}
};
</script>
<style scoped>
.buttons {
margin-top: 35px;
}
</style>