HomeDocs
Skip to main content

dlt.showToast

Introduction

Display a simple toast message that automatically disappears after a set duration.

Parameters

Object object

PropertyTypeDefault ValueRequiredDescriptionMinimum Version
msgstringNoThe text content of the toast message1.0.0
titlestringNoThe text content of the toast message3.0.0
iconstringNoIcon, valid values: "success", "error", "loading", "none"3.0.0
imagestringNoThe local path of the custom icon, image has higher priority than icon3.0.0
durationnumber1500NoThe delay time of the prompt, in milliseconds3.0.0
maskbooleanfalseNoWhether to display a transparent mask to prevent touch penetration3.0.0
successfunctionNoCallback function for a successful API call2.7.0
failfunctionNoCallback function for a failed API call2.7.0
completefunctionNoCallback function that is called when the API call is complete (whether successful or not)2.7.0

Note: You must choose one of the msg and title parameters, otherwise it will not be displayed.

Valid ValueDescriptionMinimum Version
successDisplay a success icon, at this time the title text can display up to 7 Chinese characters in length3.0.0
errorDisplay a failure icon, at this time the title text can display up to 7 Chinese characters in length3.0.0
loadingDisplay a loading icon, at this time the title text can display up to 7 Chinese characters in length3.0.0
noneDo not display an icon, at this time the title text can display up to two lines3.0.0
Description of valid values for icon

Example Code

dlt.showToast({
title: 'Success',
icon: 'success',
duration: 2000,
});
Privacy agreementDeveloper agreementcontact us: developer_service.mi@transsion.com © 2024 MiniApp. All Rights Reserved.