Skip to content

Notification ​

Displays a global notification message at a corner of the page.

Methods ​

  • Global method:Tu View Plus has added a global method $notification。 for app.config.globalProperties. So in a vue instance you can call Notification。 like what we did in this page.

  • Local import:in this case you should call TuNotification(options). We have also registered methods for different types, e.g. TuNotification.success(options). You can call TuNotification.closeAll() to manually close all the instances.

Basic usage ​

Basic usage of notification.

Types ​

The message type of the notification.

Position ​

The position attribute defines which corner Notification slides in. It can be top-right, top-left, bottom-right or bottom-left. Defaults to top-right.

With offset ​

Set the offset attribute to customize Notification is offset from the edge of the screen. Note that every Notification instance of the same moment should have the same offset.

Closable ​

By default, the notification automatically closes after 4500ms, but by setting duration you can control its duration. Specifically, if set to 0, it will not close automatically. Note that duration receives a Number in milliseconds.

Hide close button ​

Set the showClose attribute to false so the notification cannot be closed by the user.

Use HTML ​

Set dangerouslyUseHTMLString to true and message will be treated as an HTML string.

Notification API ​

Notification Attributes ​

NameDescriptionTypeDefault
titleTitleString-
messageDescription textString VNode-
dangerouslyUseHTMLStringWhether message is treated as HTML stringBooleanfalse
typeNotification typeString-
iconCustom icon component. It will be overridden by typestring Component-
custom-classCustom class name for NotificationString''
durationDuration before close. It will not automatically close if set 0Number-
positionCustom positionStringtr
show-closeWhether to show a close buttonBooleantrue
on-closeCallback function when closedFunction-
on-clickCallback function when notification clickedFunction-
offsetOffset from the top edge of the screen. Every Notification instance of the same moment should have the same offsetNumber0
appendToSet the root element for the notification, default to document.bodystring HTMLElement-
zIndexInitial zIndexNumber-

Notification Events ​

NameDescriptionType
closeClose the NotificationFunction