feat(Table): add empty prop

This commit is contained in:
Benjamin Canac
2025-03-26 17:06:42 +01:00
parent 7ec08017e0
commit afff54fecd
4 changed files with 41 additions and 3 deletions

View File

@@ -75,6 +75,11 @@ export interface TableProps<T extends TableData> extends TableOptions<T> {
data?: T[]
columns?: TableColumn<T>[]
caption?: string
/**
* The text to display when the table is empty.
* @defaultValue t('table.noData')
*/
empty?: string
/**
* Whether the table should have a sticky header.
* @defaultValue false
@@ -369,7 +374,7 @@ defineExpose({
<tr v-else>
<td :colspan="columns?.length" :class="ui.empty({ class: props.ui?.empty })">
<slot name="empty">
{{ t('table.noData') }}
{{ empty || t('table.noData') }}
</slot>
</td>
</tr>