mirror of
https://github.com/speatzle/nfsense.git
synced 2025-05-11 19:08:20 +00:00
Add Table View
This commit is contained in:
parent
6c8986c1e8
commit
aa9edc94cf
1 changed files with 41 additions and 0 deletions
41
client/src/components/TableView.vue
Normal file
41
client/src/components/TableView.vue
Normal 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>
|
Loading…
Add table
Reference in a new issue