fix: front type check
Frontend CI / build-and-check (push) Has been cancelled
🚀 Create and publish a Docker image / Detect changes in backend and frontend (push) Successful in 5s
🚀 Create and publish a Docker image / Build & publish backend image (push) Has been skipped
🚀 Create and publish a Docker image / Build & publish frontend image (push) Successful in 16s
🚀 Create and publish a Docker image / Update stack on Portainer (push) Successful in 3s
Frontend CI / build-and-check (push) Has been cancelled
🚀 Create and publish a Docker image / Detect changes in backend and frontend (push) Successful in 5s
🚀 Create and publish a Docker image / Build & publish backend image (push) Has been skipped
🚀 Create and publish a Docker image / Build & publish frontend image (push) Successful in 16s
🚀 Create and publish a Docker image / Update stack on Portainer (push) Successful in 3s
This commit is contained in:
@@ -1,8 +1,17 @@
|
||||
<script setup lang="ts">
|
||||
type Column = { key: string; label: string; align?: 'left' | 'center' | 'right' | string }
|
||||
type DataTableSlotRow = Record<string, any>
|
||||
|
||||
defineProps<{
|
||||
columns: Array<{ key: string; label: string; align?: 'left' | 'center' | 'right' | string }>
|
||||
columns: Column[]
|
||||
rows: Record<string, unknown>[]
|
||||
}>()
|
||||
|
||||
defineSlots<Record<string, (props: { row: DataTableSlotRow; value: any }) => unknown>>()
|
||||
|
||||
function getCell(row: Record<string, unknown>, key: string) {
|
||||
return row[key]
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -18,8 +27,8 @@ defineProps<{
|
||||
<tbody>
|
||||
<tr v-for="(row, i) in rows" :key="i">
|
||||
<td v-for="col in columns" :key="col.key" :class="`align-${col.align ?? 'left'}`">
|
||||
<slot :name="col.key" :row="row" :value="row[col.key]">
|
||||
{{ row[col.key] }}
|
||||
<slot :name="col.key" :row="row" :value="getCell(row, col.key)">
|
||||
{{ getCell(row, col.key) }}
|
||||
</slot>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user