VEUI

VEUI on GitHub
Play!中文

alert

Installation

import Vue from 'vue'
import { $alert } from 'veui'

Vue.use($alert)

API

After installation, this plugin provides a $alert method on all component instances, with the following signature: function(content, title, options): Promise<void>.

The method returns a Promise object that is resolved when the alert dialog is successfully closed.

NameTypeDescription
contentstringThe text content displayed in the alert dialog.
titlestringThe title of the alert dialog.
optionsObject
NameTypeDescription
statusstringThe type of the alert, one of 'success', 'warning', 'info', or 'error'. The default value is 'success'.
typestringDeprecated. Use the status property instead.
overlayClassstring | Object | Array<string>The class name(s) to be added to the root node of the alert dialog overlay.
okfunction(): Promise<void>The function to be called when the "I got it" button is clicked. If the Promise returned by this function is resolved, the dialog will be closed, otherwise it will not.
okLabelstringThe text content of the "OK" button.
themestringThe theme of the alert box. Can be 'd20' / 'd22' / 'ai'.

The $alert method also provides the following shortcut methods, which set the status option to the corresponding value:

MethodTypeDescription
successfunction(content, title, options): Promise<void>Shows an alert dialog with the "success" status.
warnfunction(content, title, options): Promise<void>Shows an alert dialog with the "warning" status.
infofunction(content, title, options): Promise<void>Shows an alert dialog with the "info" status.
errorfunction(content, title, options): Promise<void>Shows an alert dialog with the "error" status.
Edit this page on GitHubEdit
© Baidu, Inc. 2024