Dialog

A floating layer to get users' feedback or display information.

Import

import { Dialog } from  'mand-mobile-next'

Dialog.alert({ content: '' })

this.$dialog.alert({ content: '' }) // Totally Import

Code Examples

API

Dialog Props

PropsDescriptionTypeDefaultNote
v-modelwhether to show a dialog or notBooleanfalse-
titletitle of dialogString--
contentcontent of dialogString--
iconname of iconString--
icon-svgsvg iconBooleanfalseRefer to Icon component for customized icon
closablewhether the close button is visible or notBooleantrue-
layoutlayout of action buttons, row, columnStringrow-
actionsaction buttons in the footerArray<DialogBtnOptions>[]-
append-toportal node of dialogHTMLElementdocument.body-
has-maskhas mask or notBooleantrue-
mask-closableif the dialog will be closed when clicking maskBooleanfalse-
transitionthe animation effect of dialogStringrefer to Transition for optional values

DialogBtnOptions Props

PropsDescriptionTypeDefault
textbutton textString-
handlerclick callbackFunction(btn: DialogBtnOptions)-
warningwarning buttonBooleanfalse
disableddisabled buttonBooleanfalse
loadingloading buttonBooleanfalse
iconname of iconString-
iconSvgsvg iconBooleanfalse

Dialog Slots

default

Default slots is used as the content of dialog

Header slot, generally used for placing pictures, etc


Dialog Instance Methods

close()

Hide dialog

Dialog Instance Events

@show()

Invoked after dialog is shown

@hide()

Invoked after dialog is hidden

@click(btn, index)

Invoked after some button is clicked

PropsDescriptionType
btnobject corresponding to the clicked button in the btns listObject: DialogBtnOptions
indexindex of object corresponding to the clicked button in the btns listNumber

Dialog Static Methods

Dynamically create interactive dialogs

Dialog.confirm(props)

Dynamically create a confirmation dialog

PropsDescriptionTypeDefault
iconicon of message typeString-
titletitle of dialogString-
contentcontent of dialogString-
cancelTextcancelation buttonStringCancel
confirmTextconfirmation buttonStringConfirm
cancelWarningclicking the Cancel button is a warning actionBooleanfalse
confirmWarningclicking the Confirm button is a warning actionBooleanfalse
onConfirmcallback function is invoked when clicking confirmation buttonFunction-
onCancelcallback function is invoked when clicking cancellation buttonFunction-
onShowcallback function is invoked when dialog is shownFunction-
onHidecallback function is invoked when dialog is hiddenFunction-
Dialog.alert(props)

Dynamically create an alert dialog

PropsDescriptionTypeDefault
iconicon of message typeString-
titletitle of dialogString-
contentcontent of dialogString-
confirmTextconfirmation buttonStringConfirm
warningclicking the Confirm button is a warning actionBooleanfalse
onConfirmcallback function is invoked when clicking confirmation buttonFunction-
onShowcallback function is invoked when dialog is shownFunction-
onHidecallback function is invoked when dialog is hiddenFunction-
Dialog.succeed(props)

Dynamically create a success dialog

PropsDescriptionTypeDefault
titletitle of dialogString-
contentcontent of dialogString-
confirmTextconfirmation buttonStringConfirm
onConfirmcallback function is invoked when clicking confirmation buttonFunction-
onCancelcallback function is invoked when clicking cancellation buttonFunction-
onShowcallback function is invoked when dialog is shownFunction-
onHidecallback function is invoked when dialog is hiddenFunction-
Dialog.failed(props)

Dynamically create a fail dialog

PropsDescriptionTypeDefault
titletitle of dialogString-
contentcontent of dialogString-
confirmTextconfirmation buttonStringConfirm
onConfirmcallback function is invoked when clicking confirmation buttonFunction-
onCancelcallback function is invoked when clicking cancellation buttonFunction-
onShowcallback function is invoked when dialog is shownFunction-
onHidecallback function is invoked when dialog is hiddenFunction-
Dialog.closeAll()

Close all global dialogs