VDialog
VDialog is a lightweight wrapper around Element Plus ElDialog with a smaller API surface. It enables centered layout by default, adds a built-in base-dialog class, defaults destroy-on-close to true, and keeps close-on-click-modal disabled unless you opt in.
Basic Usage
Basic dialog with v-model control.
Behavior Notes
VDialogonly exposesmodel-value,title,width,class,destroy-on-close, andclose-on-click-modalfrom the wrapper, and forwards any extraElDialogprops throughdialog-props.- The underlying dialog always renders with
align-centerenabled. - The rendered dialog class always includes
base-dialog. Theclassprop appends extra class names to it. close-call-backis emitted whenever the dialog visibility changes tofalse, whether the dialog closes itself or the parent setsv-modeltofalse.
API
VDialog Attributes
| Name | Description | Type | Default |
|---|---|---|---|
| model-value / v-model | dialog visibility | boolean | false |
| title | dialog title | string | '' |
| width | dialog width | string / number | '50%' |
| class | extra CSS class appended after the built-in base-dialog | string | '' |
| destroy-on-close | destroy dialog content when closed | boolean | true |
| close-on-click-modal | close dialog when clicking the modal overlay | boolean | false |
| dialog-props | extra props object forwarded to the underlying ElDialog, spread onto the dialog | object | {} |
VDialog Events
| Name | Description | Type |
|---|---|---|
| update:model-value | triggered when visibility changes | function |
| close-call-back | triggered whenever the dialog visibility becomes false | function |
VDialog Slots
All named slots are forwarded to ElDialog. Commonly used slots are listed below.
| Name | Description |
|---|---|
| default | dialog body content |
| header | custom dialog header |
| footer | custom dialog footer |