my.showToast

Show the toast dialog, which disappears with the specified duration.

Sample Code

copy
my.showToast({
  type: 'success',
  content: 'Success',
  duration: 3000,
  success: () => {
    my.alert({
      title: 'toast is missing',
    });
  },
});

Parameters

PropertyType

Required

Description
contentStringNoText content.
typeStringNoToast type, showing the related icon, none by default, Supporting success/fail/exception/none Here. If it is exception, content is mandatory.
durationNumberNoDisplaying duration, in ms, 2000 by default.
successFunctionNoCallback function upon call success.
failFunctionNoCallback function upon call failure.
completeFunctionNoCallback function upon call completion (to be executed upon either call success or failure).