feat: add DataTable component
This commit is contained in:
parent
0145c7f70c
commit
ee336f9abe
1 changed files with 41 additions and 0 deletions
41
src/components/DataTable.vue
Normal file
41
src/components/DataTable.vue
Normal file
|
@ -0,0 +1,41 @@
|
|||
<script setup lang="ts">
|
||||
interface Props {
|
||||
headings: string[];
|
||||
data: string[][];
|
||||
}
|
||||
|
||||
defineProps<Props>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<table class="data-table">
|
||||
<thead class="data-table__head">
|
||||
<tr class="data-table__row">
|
||||
<th
|
||||
class="data-table__heading"
|
||||
v-for="(heading, idx) in headings"
|
||||
:key="idx"
|
||||
>
|
||||
{{ heading }}
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="data-table__body">
|
||||
<tr class="data-table__row" v-for="(row, idx) in data" :key="idx">
|
||||
<td class="data-table__cell" v-for="(cell, idx) in row" :key="idx">
|
||||
{{ cell }}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.data-table {
|
||||
table-layout: fixed;
|
||||
|
||||
&__cell:first-child {
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
</style>
|
Loading…
Add table
Add a link
Reference in a new issue