Home > WeChat Applet > Mini Program Development > WeChat Mini Program: Interactive Feedback API Description

WeChat Mini Program: Interactive Feedback API Description

高洛峰
Release: 2017-03-03 10:41:28
Original
2602 people have browsed it

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()
Copy after login


Hide message prompt box

wx.showToast({
    title: '加载中',
    icon: 'loading',
    duration: 10000
}) setTimeout(function() {
    wx.hideToast()
},
2000) wx.showModal(OBJECT)
Copy after login




##Show Modal pop-up window
OBJECT parameter description:[tr]Parameter type required description[/tr]

titleString is the title of promptcontentString YesPrompt contentshowCancelBooleanNoWhether to display the cancel button, the default is truecancelTextStringNoThe text of the cancel button, the default is "Cancel"cancelColorHexColorNoThe text color of the cancel button, the default is "#000000"confirmTextStringNoThe text of the confirmation button, the default is "OK"confirmColorHexColorNoDetermine the text color of the button, the default is "#3CC51F"##successfailcomplete
Function NoThe interface calls the callback function successfully. When res.confirm==1 is returned, it means the user clicked the OK button
FunctionNoCallback function for failed interface call
FunctionNo The callback function at the end of the interface call (will be executed if the call is successful or failed)
Sample code:

wx.showModal({
    title: '提示',
    content: '这是一个模态弹窗',
    success: function(res) {
        if (res.confirm) {
            console.log('用户点击确定')
        }
    }
}) wx.showActionSheet(OBJECT)
Copy after login


Display operation menu
OBJECT parameter description:
[tr]Required description of parameter type[/tr]

itemListitemColorsuccessfail complete
String Array is the text array of the button. The maximum length of the array is 6
HexColorNoThe text color of the button, the default is "#000000"
FunctionNoThe interface calls the callback function successfully, please see the return parameter description for details
FunctionNoCallback function for failed interface call
FunctionNoThe callback function at the end of the interface call (will be executed if the call is successful or failed)
success return parameter description:

[tr]Parameter type description[/tr]

canceltapIndex
BooleanWhether the user cancels the selection
NumberThe buttons clicked by the user, in order from top to bottom, starting from 0
Sample code:

wx.showActionSheet({
    itemList: ['A', 'B', 'C'],
    success: function(res) {
        if (!res.cancel) {
            console.log(res.tapIndex)
        }
    }
})
Copy after login


More WeChat mini programs: Interactive Feedback API instructions Please pay attention to the PHP Chinese website for related articles!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template