wx.showToast(OBJECT)
Display message prompt box
OBJECT parameter description:
[tr] Parameter type required description[/tr]
title | String | is the content of | prompt |
icon | String | No | icon, only supports "success" and "loading" |
duration | Number | No | The prompt delay time, in milliseconds, default: 1500, the maximum is 10000 |
success | Function | No | Callback function for successful interface call |
fail | Function | No | Callback function for failed interface call |
complete | Function | No | The callback function at the end of the interface call (will be executed if the call is successful or failed) |
Sample code:
wx.showToast({ title: '成功'icon: 'success', duration: 2000 }) wx.hideToast()
Hide message prompt box
wx.showToast({ title: '加载中', icon: 'loading', duration: 10000 }) setTimeout(function() { wx.hideToast() }, 2000) wx.showModal(OBJECT)
##Show Modal pop-up window
OBJECT parameter description:[tr]Parameter type required description[/tr]
String | is the title of | prompt | |
String | Yes | Prompt content | |
Boolean | No | Whether to display the cancel button, the default is true | |
String | No | The text of the cancel button, the default is "Cancel" | |
HexColor | No | The text color of the cancel button, the default is "#000000" | |
String | No | The text of the confirmation button, the default is "OK" | |
HexColor | No | Determine the text color of the button, the default is "#3CC51F" | |
Function | No | The interface calls the callback function successfully. When res.confirm==1 is returned, it means the user clicked the OK button | |
Function | No | Callback function for failed interface call | |
Function | No | The callback function at the end of the interface call (will be executed if the call is successful or failed) |
wx.showModal({ title: '提示', content: '这是一个模态弹窗', success: function(res) { if (res.confirm) { console.log('用户点击确定') } } }) wx.showActionSheet(OBJECT)
Display operation menu
OBJECT parameter description:
[tr]Required description of parameter type[/tr]
String Array | is the text array of the | button. The maximum length of the array is 6 | |
HexColor | No | The text color of the button, the default is "#000000" | |
Function | No | The interface calls the callback function successfully, please see the return parameter description for details | |
Function | No | Callback function for failed interface call | |
Function | No | The callback function at the end of the interface call (will be executed if the call is successful or failed) |
[tr]Parameter type description[/tr]
Boolean | Whether the user cancels the selection | |
Number | The buttons clicked by the user, in order from top to bottom, starting from 0 |
wx.showActionSheet({ itemList: ['A', 'B', 'C'], success: function(res) { if (!res.cancel) { console.log(res.tapIndex) } } })
More WeChat mini programs: Interactive Feedback API instructions Please pay attention to the PHP Chinese website for related articles!