Skip to content

Commit 2ad38d0

Browse files
committed
fix bug with showRow
1 parent a1d4405 commit 2ad38d0

File tree

1 file changed

+36
-21
lines changed

1 file changed

+36
-21
lines changed

adminforth/spa/src/components/ShowTable.vue

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,34 @@
2020
:key="column.name"
2121
class="bg-lightForm bg-darkForm odd:dark:bg-gray-900 even:dark:bg-gray-800 dark:border-gray-700 block md:table-row"
2222
>
23-
<td class="px-6 py-4 relative block md:table-cell font-bold md:font-normal pb-0 md:pb-4">
24-
{{ column.label }}
25-
</td>
26-
<td class="px-6 py-4 whitespace-pre-wrap" :data-af-column="column.name">
27-
<component
28-
v-if="column?.components?.show"
29-
:is="getCustomComponent(column?.components?.show)"
30-
:resource="resource"
31-
:meta="column.components.show.meta"
32-
:column="column"
33-
:record="record"
23+
<component
24+
v-if="column.components?.showRow"
25+
:is="getCustomComponent(column.components.showRow)"
26+
:meta="column.components.showRow.meta"
27+
:column="column"
28+
:resource="coreStore.resource"
29+
:record="coreStore.record"
3430
/>
35-
<ValueRenderer
36-
v-else
37-
:column="column"
38-
:record="record"
39-
/>
40-
</td>
31+
<template v-else>
32+
<td class="px-6 py-4 relative block md:table-cell font-bold md:font-normal pb-0 md:pb-4">
33+
{{ column.label }}
34+
</td>
35+
<td class="px-6 py-4 whitespace-pre-wrap" :data-af-column="column.name">
36+
<component
37+
v-if="column?.components?.show"
38+
:is="getCustomComponent(column?.components?.show)"
39+
:resource="resource"
40+
:meta="column.components.show.meta"
41+
:column="column"
42+
:record="record"
43+
/>
44+
<ValueRenderer
45+
v-else
46+
:column="column"
47+
:record="record"
48+
/>
49+
</td>
50+
</template>
4151
</tr>
4252
</tbody>
4353
</table>
@@ -48,19 +58,24 @@
4858
import { defineProps } from 'vue';
4959
import ValueRenderer from '@/components/ValueRenderer.vue';
5060
import { getCustomComponent } from '@/utils';
51-
61+
import { useCoreStore } from '@/stores/core';
5262
defineProps<{
5363
columns: Array<{
5464
name: string;
5565
label: string;
5666
components?: {
57-
show?: {
58-
meta: Record<string, any>;
59-
};
67+
show?: {
68+
meta: Record<string, any>;
69+
};
70+
showRow?: {
71+
meta: Record<string, any>;
72+
};
6073
};
6174
}>;
6275
groupName?: string | null;
6376
resource: Record<string, any>;
6477
record: Record<string, any>;
6578
}>();
79+
80+
const coreStore = useCoreStore();
6681
</script>

0 commit comments

Comments
 (0)