search
HomeWeChat AppletMini Program DevelopmentWeChat Mini Program: Interactive Feedback API Description

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]

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 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)
Sample code:

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]

itemListitemColorsuccessfail complete
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)
success return parameter description:

[tr]Parameter type description[/tr]

canceltapIndex
Boolean Whether the user cancels the selection
Number The 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)
        }
    }
})


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

Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment