feat: 增加表头操作功能,支持动态控制操作按钮显示;优化银行卡信息展示

This commit is contained in:
2025-12-22 04:05:17 +07:00
parent 23b9997bd3
commit 672d7c8958
4 changed files with 69 additions and 33 deletions

View File

@@ -9,6 +9,12 @@ interface Props {
itemAlign?: NaiveUI.Align;
disabledDelete?: boolean;
loading?: boolean;
operations?: {
add?: boolean;
refresh?: boolean;
delete?: boolean;
columns?: boolean;
};
}
defineProps<Props>();
@@ -43,27 +49,34 @@ function refresh() {
<slot name="prefix"></slot>
<div class="space-x-5">
<slot name="default">
<NButton size="small" ghost type="primary" @click="add">
<NButton v-if="operations?.add" size="small" ghost type="primary" @click="add">
<template #icon>
<icon-ic-round-plus class="text-icon" />
</template>
{{ $t('common.add') }}
</NButton>
<NButton size="small" ghost type="error" :disabled="disabledDelete" @click="batchDelete">
<NButton
v-if="operations?.delete"
size="small"
ghost
type="error"
:disabled="disabledDelete"
@click="batchDelete"
>
<template #icon>
<icon-ic-round-delete class="text-icon" />
</template>
{{ $t('common.batchDelete') }}
</NButton>
</slot>
<NButton size="small" @click="refresh">
<NButton v-if="operations?.refresh" size="small" @click="refresh">
<template #icon>
<icon-mdi-refresh class="text-icon" :class="{ 'animate-spin': loading }" />
</template>
{{ $t('common.refresh') }}
</NButton>
<TableColumnSetting v-model:columns="columns" />
<TableColumnSetting v-if="operations?.columns" v-model:columns="columns" />
</div>
<slot name="suffix"></slot>
</NSpace>