Skip to content

useImperativeAlertDialog

@astryxdesign/core v0.7.1 · useImperativeAlertDialog

返回值 ​

名称类型说明
show(options: ImperativeAlertDialogOptions) => void按给定配置弹出对话框。配置就是 AlertDialog 的属性去掉 isOpen,再加上 onAction。
hide() => void关掉对话框。
isOpenRef<boolean>对话框当前是否打开。
HostComponent承载对话框的组件。在模板里渲染一次:<component :is="alert.Host" />。

配置项 ​

名称类型默认值说明
titlestring—要问的问题,通过 aria-labelledby 成为对话框的名字。必填。
descriptionstring—确认之后会发生什么,通过 aria-describedby 和对话框关联,读屏会一起念出来。必填。
actionLabelstring—确认按钮的文字。写清楚会发生什么,例如 'Delete project'。必填。
onAction(event: MouseEvent) => void—确认动作被触发时调用。对话框不会自己关:事情办完你自己调 hide()。
cancelLabelstring'Cancel'取消按钮的文字。
actionVariantAlertDialogActionVariant'destructive'确认按钮的视觉样式。
isActionLoadingbooleanfalse确认动作还在跑的时候,在按钮上显示转圈。
widthnumber | string400期望宽度。数字按像素,字符串原样使用。