mirror of
https://github.com/speatzle/nfsense.git
synced 2025-05-11 19:08:20 +00:00
Move Logic out of Table View
This commit is contained in:
parent
234ad792d1
commit
8976d32caf
1 changed files with 5 additions and 18 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
const props = defineModel<{
|
||||
title: string,
|
||||
loadData: () => void,
|
||||
loading: boolean,
|
||||
columns?: {
|
||||
heading: string,
|
||||
path: string,
|
||||
|
@ -10,32 +10,19 @@ const props = defineModel<{
|
|||
}[],
|
||||
data: Record<string, any>[],
|
||||
tableProps: any,
|
||||
selection?: number[],
|
||||
}>();
|
||||
|
||||
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();
|
||||
});
|
||||
let { title, columns, loadData, data, selection, tableProps } = $(props);
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<PageHeader :title="title">
|
||||
<button @click="load">Load</button>
|
||||
<slot/>
|
||||
</PageHeader>
|
||||
<div v-if="loading" >Loading...</div>
|
||||
<NiceTable v-else :columns="columns" v-bind="tableProps" :data="data"/>
|
||||
<NiceTable v-else :columns="columns" v-model:selection="selection" v-bind="tableProps" :data="data"/>
|
||||
</div>
|
||||
</template>
|
Loading…
Add table
Reference in a new issue