Skip to content
On this page

VToast ​

Toast components for different toast styles

Import ​

js
import { VToast } from 'vui-vc-next'

app.component(VToast.name, VToast)

API ​

Toast Static Methods ​

Toast({value, content, icon, iconSvg, duration, position, hasMask, parentNode}) ​

Dynamically create a toast

PropsDescriptionTypeDefaultNote
valueWhether display toastBooleanfalse-
iconThe icon nameString-refer to Icon component for customized icons
iconSvgWhether use SVG iconBooleanfalse-
contentThe content of messageString/Number--
durationThe toast will be closed in milliseconds; if set duration as 0, the toast will always be visibleNumber3000-
positionThe display positionStringcentertop/center/bottom
hasMaskWhether display a transparent mask, which will prevent users from clickingBooleanfalse-
parentNodeThe parent node of toastHTMLElementdocument.body-
Toast.info(content, duration, hasMask, parentNode) ​

Dynamically create a text toast

PropsDescriptionTypeDefaultNote
contentcontent of messageString/Number--
durationtoast will be closed in milliseconds; if set duration as 0, the toast will always be visibleNumber3000-
hasMaskwhether to show a transparent mask, which will prevent users from clickingBooleanfalse-
parentNodeportal node of toastHTMLElementdocument.body-
Toast.succeed(content, duration, hasMask, parentNode) ​

Dynamically create a success toast

PropsDescriptionTypeDefaultNote
contentcontent of messageString/Number--
durationtoast will be closed in milliseconds; if set duration as 0, the toast will always be visibleNumber3000-
hasMaskwhether to show a transparent mask, which will prevent users from clickingBooleanfalse-
parentNodeportal node of toastHTMLElementdocument.body-
Toast.failed(content, duration, hasMask, parentNode) ​

Dynamically create a failed toast

PropsDescriptionTypeDefaultNote
contentcontent of messageString/Number--
durationtoast will be closed in milliseconds; if set duration as 0, the toast will always be visibleNumber3000-
hasMaskwhether to show a transparent mask, which will prevent users from clickingBooleanfalse-
parentNodeportal node of toastHTMLElementdocument.body-
Toast.loading(content, duration, hasMask, parentNode) ​

Dynamically create a loading toast

PropsDescriptionTypeDefaultNote
contentcontent of messageString/Number--
durationtoast will be closed in milliseconds; if set duration as 0, the toast will always be visibleNumber0-
hasMaskwhether to show a transparent mask, which will prevent users from clickingBooleanfalse-
parentNodeportal node of toastHTMLElementdocument.body-
Toast.hide() ​

Hide current toast

Toast.component Props ​

PropsDescriptionTypeDefaultNote
iconname of iconString-refer to Icon component for customized icons
iconSvguse svg iconBooleanfalse-
contentcontent of messageString/Number--
durationtoast will be closed in milliseconds; if set duration as 0, the toast will always be visibleNumber3000-
positiondisplay positionStringcentertop/center/bottom
hasMaskwhether to show a transparent mask, which will prevent users from clickingBooleanfalse-

Toast.component Methods ​

show() ​

Show toast

hide() ​

Hide toast

Toast.component Events ​

@show() ​

Toast show event

@hide() ​

Toast hidden event