Skip to content

Dialog / Drawer / Confirm

居中弹窗 RdDialog、侧滑 RdDrawer、Promise 确认框 rdConfirm(打开动态挂载,关闭自动卸载)。 删除等不可逆操作前二次确认;点遮罩默认抖动不关闭。

Dialog 基础用法

新建客户、居中确认/表单弹窗等模态流程。默认 maskClosable=false:点遮罩抖动且不关闭。

Drawer 基础用法

全部筛选(form)、客户详情(workspace)等侧滑面板。多层抽屉自动堆栈,点外侧关闭最上层。

Confirm 确认弹窗

调用 rdConfirm.confirm()useConfirm() 即可;打开时动态挂载,关闭后卸载,无需在根布局常驻组件。

行为说明

  • 遮罩抖动maskClosable=false 时点击遮罩触发 is-shaking,不关闭面板
  • ConfirmrdConfirm.confirm() 命令式打开;应用需 app.use(@rd-element/ui)setConfirmAppContext(app._context)
  • Drawer 栈:嵌套抽屉共享 useRdDrawerStack,点外侧关闭最上层(或抖动)

API

RdDialog Attributes

属性名说明类型默认值
v-model:visible是否显示booleanfalse
title标题string''
description副标题 / 说明string''
width宽度;复杂表单可传 720pxstring | number'520px'
maskClosable点击遮罩是否关闭;false 时抖动不关闭booleanfalse
showClose是否显示关闭按钮booleantrue
alignCenter垂直居中booleantrue
destroyOnClose关闭时销毁内容booleanfalse

RdDialog Events

事件名说明类型
open / opened打开时 / 打开动画结束() => void
close / closed关闭时 / 关闭动画结束() => void

RdDialog Slots

插槽名说明
default正文
header自定义标题区
footer底栏操作

RdDrawer Attributes

属性名说明类型默认值
v-model:visible是否显示booleanfalse
variantform 窄抽屉带标题;workspace 宽工作区'form' | 'workspace''form'
title / descriptionform 标题栏文案string''
size宽度;默认 form=400px,workspace=80%string | number
maskClosable点外侧是否关闭最上层booleanform=false / workspace=true
direction滑出方向'rtl' | 'ltr' | 'ttb' | 'btt''rtl'
nested多层嵌套标记booleanfalse
showClose / withHeader关闭按钮 / 是否展示标题栏boolean

RdDrawer Events

事件名说明类型
open / opened打开时 / 打开动画结束() => void
close / closed关闭时 / 关闭动画结束() => void

RdDrawer Slots

插槽名说明
default正文
footer底栏操作

rdConfirm.confirm / ConfirmOptions

属性名说明类型默认值
title标题string
body说明文案string
type语义色与图标'warning' | 'danger' | 'info''warning'
confirmText确认按钮文案string'确定'
cancelText取消按钮文案string'取消'

返回 Promise<boolean>true = 用户确认)。