# wx.showToast(Object object)

Displays the message prompt box.

# Parameters

# Object object

Property Type Default Value Required Description Minimum Version
title string Yes Prompt content
icon string 'success' No Icon
image string No The local path of the custom icon. image has priority over icon. 1.1.0
duration number 1500 No The delay time for a prompt
mask boolean false No Indicates whether to display a transparent mask to prevent touch penetration
success function No The callback function for a successful API call
fail function No The callback function for a failed API call
complete function No The callback function used when the API call completed (always executed whether the call succeeds or fails)

Valid values of object.icon

Value Description Minimum Version
success The success icon is displayed. And the title text displays a maximum of 7 Chinese characters.
loading The loading icon is displayed. And the title text displays a maximum of 7 Chinese characters.
none No icon is displayed. And the title text can be displayed in up to two lines. This is supported in 1.9.0 and above.

# Sample Code

wx.showToast({
  title: 'Success',
  icon: 'success',
  duration: 2000
})

# Notes

Either - wx.showLoading or wx.showToast can be displayed.

点击咨询小助手