feat: alert support customize footer (#5940)

* Alert组件支持自定义footer
This commit is contained in:
Netfan
2025-04-14 11:48:21 +08:00
committed by GitHub
parent ff88274554
commit f0e9e55af2
4 changed files with 46 additions and 1 deletions

View File

@@ -34,6 +34,8 @@ export type AlertProps = {
contentClass?: string;
/** 执行beforeClose回调期间在内容区域显示一个loading遮罩*/
contentMasking?: boolean;
/** 弹窗底部内容(与按钮在同一个容器中) */
footer?: Component | string;
/** 弹窗的图标(在标题的前面) */
icon?: Component | IconType;
/**

View File

@@ -157,7 +157,11 @@ async function handleOpenChange(val: boolean) {
</div>
<VbenLoading v-if="loading && contentMasking" :spinning="loading" />
</AlertDialogDescription>
<div class="flex justify-end gap-x-2" :class="`justify-${buttonAlign}`">
<div
class="flex items-center justify-end gap-x-2"
:class="`justify-${buttonAlign}`"
>
<VbenRenderContent :content="footer" />
<AlertDialogCancel v-if="showCancel" as-child>
<component
:is="components.DefaultButton || VbenButton"