refactor: table component custom column
This commit is contained in:
parent
927841eda5
commit
ce5345eb02
1 changed files with 12 additions and 3 deletions
|
|
@ -16,6 +16,7 @@ const props = withDefaults(
|
||||||
hidePagination?: boolean;
|
hidePagination?: boolean;
|
||||||
|
|
||||||
imgColumn?: string;
|
imgColumn?: string;
|
||||||
|
customColumn?: string[];
|
||||||
}>(),
|
}>(),
|
||||||
{
|
{
|
||||||
row: () => [],
|
row: () => [],
|
||||||
|
|
@ -26,6 +27,7 @@ const props = withDefaults(
|
||||||
hideHeader: false,
|
hideHeader: false,
|
||||||
buttomDownload: false,
|
buttomDownload: false,
|
||||||
imgColumn: '',
|
imgColumn: '',
|
||||||
|
customColumn: () => [],
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -45,8 +47,6 @@ defineEmits<{
|
||||||
:no-data-label="$t('general.noDataTable')"
|
:no-data-label="$t('general.noDataTable')"
|
||||||
:hide-pagination
|
:hide-pagination
|
||||||
>
|
>
|
||||||
<slot name="zxc"></slot>
|
|
||||||
|
|
||||||
<template v-slot:header="props">
|
<template v-slot:header="props">
|
||||||
<q-tr
|
<q-tr
|
||||||
style="background-color: hsla(var(--info-bg) / 0.07)"
|
style="background-color: hsla(var(--info-bg) / 0.07)"
|
||||||
|
|
@ -77,8 +77,17 @@ defineEmits<{
|
||||||
</q-td>
|
</q-td>
|
||||||
</template>
|
</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">
|
<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" />
|
<DeleteButton iconOnly v-if="buttonDelete" />
|
||||||
|
|
||||||
<q-btn
|
<q-btn
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue