Alert

Updated at:

Introduction

The alert widget is a basic component that displays important information or warnings in the user interface.

Configuration items

Category

Configuration

Example

Description

Content

Type

The widget has four types: default, success, warning, and error.

Content

The title of the alert.

Description

The text description of the alert.

Show icon

Shows or hides the icon on the widget frontend.

Icon

The icon displayed in the alert.

Interaction

Hidden

Hides the widget. For more information, see Common properties.

Closable

Makes the alert closable.

Style

Margin

The outer margin. For more information, see Common properties.

Content font size

The font size of the alert title.

Description font size

Warning box Description font size

Properties and methods

Name

Type

Example

Description

type

string

alert.type

The alert type. The value can be `info`, `success`, `warning`, or `error`.

message

string

alert.message

The content of the alert.

description

string

alert.description

The description of the alert.

closable

boolean

alert.closable

Specifies whether the alert widget can be closed.

hidden

boolean

alert.hidden

Specifies whether the widget is hidden.

clearClosable

func

alert.clearClosable()

Clears the `closable` value of the widget.

clearDescription

func

alert.clearDescription()

Clears the `description` value of the widget.

clearHidden

func

alert.clearHidden()

Clears the `hidden` value of the widget.

clearMessage

func

alert.clearMessage()

Clears the `message` value of the widget.

clearType

func

alert.clearType()

Clears the `type` value of the widget.

setClosable

func

alert.setClosable(true)

Sets whether the alert widget can be closed.

setHidden

func

alert.setHidden(true)

Sets whether the alert widget is hidden.

setDescription

func

alert.setDescription('Description')

Sets the description of the alert widget.

setMessage

func

alert.setMessage('Content')

Sets the content of the alert widget.

setType

func

alert.setType('success')

Sets the `type` value of the widget. The value can be `info`, `success`, `warning`, or `error`.

Event callbacks

Configuration

Description

The callback that is triggered when the alert is closed.