refactor: table component custom column

This commit is contained in:
puriphatt 2024-09-26 11:52:34 +07:00
parent 927841eda5
commit ce5345eb02

View file

@ -16,6 +16,7 @@ const props = withDefaults(
hidePagination?: boolean;
imgColumn?: string;
customColumn?: string[];
}>(),
{
row: () => [],
@ -26,6 +27,7 @@ const props = withDefaults(
hideHeader: false,
buttomDownload: false,
imgColumn: '',
customColumn: () => [],
},
);
@ -45,8 +47,6 @@ defineEmits<{
:no-data-label="$t('general.noDataTable')"
:hide-pagination
>
<slot name="zxc"></slot>
<template v-slot:header="props">
<q-tr
style="background-color: hsla(var(--info-bg) / 0.07)"
@ -77,8 +77,17 @@ defineEmits<{
</q-td>
</template>
<template
v-for="col in customColumn"
:key="col"
v-slot:[`body-cell-${col}`]="props"
>
<slot :name="`body-cell-${col}`" :props="props"></slot>
</template>
<template v-slot:body-cell-action="props">
<q-td class="text-center">
<q-td class="text-center row items-center">
<slot name="button" :props="props"></slot>
<DeleteButton iconOnly v-if="buttonDelete" />
<q-btn