# wx.showToast(Object object)
with Promise style call: Supported
Mini Program plugin: Support, need to Mini Program base library version no less than 1.9.6
Display Message Prompt Box
# parameter
# Object object
attribute | type | Default values | Required | Introductions | Minimum version |
---|---|---|---|---|---|
title | string | yes | Content of the prompt | ||
icon | string | success | no | icon | |
image | string | no | Custom icon local path, image Has a higher priority than icon | 1.1.0 | |
duration | number | 1500 | no | Prompt delay time | |
mask | boolean | false | no | Whether to display transparent mask to prevent touch penetration | |
success | function | no | Interface calls the successful callback function | ||
fail | function | no | Interface calls failed callback functions | ||
complete | function | no | Callback function at the end of an interface call (both successful and unsuccessful calls are executed) |
object.icon Legal value
value | Introductions | Minimum version |
---|---|---|
success | Display success icon, at this time title Text max display 7 Length of Chinese characters | |
error | Displays the failure icon, at which point title Text max display 7 Length of Chinese characters | |
loading | Display the load icon, at this time title Text max display 7 Length of Chinese characters | |
none | Does not display icons, at this time title Up to two lines of text, 1.9.0 and above support |
# sample code
wx.showToast({
title: "Success"?
icon: 'success',
duration: 2000
})
# Be careful
- wx.showLoading and wx.showToast Can only display one at a time
- wx.showToast Should wx.hideToast Paired use