Updated Data Table Component

This commit is contained in:
Sebin Nyshkim 2019-11-03 20:45:24 +01:00
parent 4955756ce7
commit 62d403ffc2

View file

@ -2,15 +2,15 @@
<table> <table>
<thead> <thead>
<tr> <tr>
<template v-for="header in headers"> <template v-for="header in dataset.headers">
<th :key="header">{{ header }}</th> <th :key="header">{{ header }}</th>
</template> </template>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<template v-for="dataset in data"> <template v-for="tuple in dataset.data">
<tr :key="dataset[0]"> <tr :key="tuple[0]">
<template v-for="item in dataset"> <template v-for="item in tuple">
<td :key="item">{{ item }}</td> <td :key="item">{{ item }}</td>
<template v-if="isHexValue(item)"> <template v-if="isHexValue(item)">
<td :key="item" :style="'background-color:'+item"></td> <td :key="item" :style="'background-color:'+item"></td>
@ -24,9 +24,9 @@
<script> <script>
export default { export default {
name: "DataTable",
props: { props: {
headers: Array, dataset: Object
data: Array
}, },
methods: { methods: {
isHexValue(value) { isHexValue(value) {