FormDialog ​

FormDialog combines VDialog and VForm into a single component for form-in-dialog flows. It provides built-in cancel / confirm buttons, form validation, an optional content loading mask, and a fullscreen toggle in the title area.

Basic Usage ​

Basic form dialog with form-items and on-submit.

Custom Content ​

Use the content slot to render extra content below the built-in form.

Fullscreen Toggle ​

Set with-full-screen to show a fullscreen toggle button in the dialog title.

Complete example ​

Combine v-model, submit-callback, footer slots, on-after-close, and the exposed clearValidate() method in one dialog workflow.

Current form data
{
  "name": "",
  "email": "",
  "role": "",
  "remark": ""
}
Last validated payload
No validated payload yet
Status

Behavior Notes ​

  • dialog-visible / v-model:dialog-visible controls dialog visibility.
  • model-value / v-model binds the form data object managed by the inner VForm.
  • Clicking the confirm button validates the inner form first. After validation succeeds, submit-callback runs before on-submit.
  • While on-submit is running, the component enables the internal loading state for the confirm button. When auto-loading is true, that loading state is cleared automatically after the awaited callback finishes.
  • on-after-close runs whenever the wrapped dialog finishes closing and also resets the internal loading state.
  • with-full-screen only shows the toggle icon. The fullscreen state itself is managed internally by FormDialog.
  • mode='readonly' passes disabled to the inner VForm, making the generated form items non-editable. mode='edit' keeps them editable.
  • mode='readonly' only affects the generated form fields. Footer buttons still follow show-footer, show-sure-button, and show-cancle-button.

API ​

FormDialog Attributes ​

NameDescriptionTypeDefault
titledialog titlestring'编辑弹窗'
dialog-visible / v-model:dialog-visibledialog visibilitybooleanfalse
model-value / v-modelform data objectobject{}
dialog-propsextra props object forwarded to the inner VDialog, merged down to the underlying ElDialogobject{}
form-itemsform item configuration passed to VFormarray[]
widthdialog widthstring / number'70%'
label-widthform label widthstring / number'160px'
label-positionform label positionenum'right'
content-loadingshow a loading mask over the dialog body content areabooleanfalse
show-footershow the built-in footerbooleantrue
show-sure-buttonshow the confirm buttonbooleantrue
show-cancle-buttonshow the cancel buttonbooleantrue
disabled-sure-buttondisable the confirm buttonbooleanfalse
cancel-textcancel button text, falls back to the locale message when unsetstring—
sure-textconfirm button text, falls back to the locale message when unsetstring—
with-full-screenshow the fullscreen toggle icon in the title areabooleanfalse
auto-loadingautomatically clear loading after awaited on-submit completesbooleantrue
on-submitawaited callback invoked after validation succeedsfunction—
submit-callbackcallback invoked after validation succeeds and before on-submitfunction—
on-after-closecallback invoked after the dialog closesfunction—
modecontrol whether the generated form is editable or readonlyenum'edit'

FormDialog Events ​

NameDescriptionType
update:dialog-visibletriggered when dialog visibility changesfunction
update:model-valuetriggered when form data changesfunction

FormDialog Slots ​

NameDescription
titlecustom dialog title; slot props: { close, titleId, titleClass }
headerextra content rendered at the top of the dialog body, below the title area
formFootercustom content rendered after the generated form items
contentcustom content rendered below the form
leftButtonscustom buttons rendered on the left side of the footer; slot props: { loading, formData, changeLoadingStatus }
middleButtonscustom buttons rendered between the cancel and confirm buttons; slot props: { loading, formData, changeLoadingStatus }

Exposes ​

NameDescriptionType
clearValidateclear form validation statefunction

Source ​

Docs