Add Table View

This commit is contained in:
Samuel Lorch 2023-03-29 16:59:28 +02:00
parent 6c8986c1e8
commit aa9edc94cf

View file

@ -0,0 +1,41 @@
<script setup lang="ts">
const props = defineModel<{
title: string,
loadData: () => void,
columns?: {
heading: string,
path: string,
component?: Component,
}[],
data: Record<string, any>[],
tableProps: any,
}>();
let { title, columns, loadData, data, tableProps } = $(props);
let loading = $ref(true);
async function load() {
console.debug("Start loading...");
loading = true;
loadData();
loading = false;
console.debug("Finished loading");
}
onMounted(async() => {
load();
});
</script>
<template>
<div>
<PageHeader :title="title">
<button @click="load">Load</button>
</PageHeader>
<div v-if="loading" >Loading...</div>
<NiceTable v-else :columns="columns" v-bind="tableProps" :data="data"/>
</div>
</template>