dlt.showToast
Introduction
Display a simple toast message that automatically disappears after a set duration.
Parameters
Object object
| Property | Type | Default Value | Required | Description | Minimum Version |
|---|---|---|---|---|---|
| msg | string | No | The text content of the toast message | 1.0.0 | |
| title | string | No | The text content of the toast message | 3.0.0 | |
| icon | string | No | Icon, valid values: "success", "error", "loading", "none" | 3.0.0 | |
| image | string | No | The local path of the custom icon, image has higher priority than icon | 3.0.0 | |
| duration | number | 1500 | No | The delay time of the prompt, in milliseconds | 3.0.0 |
| mask | boolean | false | No | Whether to display a transparent mask to prevent touch penetration | 3.0.0 |
| success | function | No | Callback function for a successful API call | 2.7.0 | |
| fail | function | No | Callback function for a failed API call | 2.7.0 | |
| complete | function | No | Callback 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 Value | Description | Minimum Version |
|---|---|---|
| success | Display a success icon, at this time the title text can display up to 7 Chinese characters in length | 3.0.0 |
| error | Display a failure icon, at this time the title text can display up to 7 Chinese characters in length | 3.0.0 |
| loading | Display a loading icon, at this time the title text can display up to 7 Chinese characters in length | 3.0.0 |
| none | Do not display an icon, at this time the title text can display up to two lines | 3.0.0 |
Description of valid values for icon
Example Code
dlt.showToast({
title: 'Success',
icon: 'success',
duration: 2000,
});