Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to display message prompt box in WeChat Mini Programs development

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article will introduce in detail "how to display the message prompt box in the development of WeChat Mini Programs", the content steps are clear and detailed, and the details are handled properly, and the editor updates different knowledge points every day. I hope that this article "how to display the message prompt box in the development of WeChat Mini Programs" can give you unexpected gains, please follow the editor's ideas slowly in depth, the specific contents are as follows, let's go to harvest new knowledge.

Wx.showToast (OBJECT)

Displays a message prompt box.

OBJECT parameter description:

Parameter type is required to indicate that the minimum version of titleString is the content iconString No icon prompted, valid values "success" and "loading" imageString No customize the local path of the icon, and the priority of image is higher than the delay time (in milliseconds) prompted by icon1.1.0durationNumber. Default: whether 1500maskBoolean displays a transparent mask to prevent touch penetration. Default: falsesuccessFunction No API calls successful callback function failFunction No API calls failed callback function completeFunction No API calls the finished callback function (both successful and failed calls will be executed)

Sample code:

Wx.showToast ({title: 'success', icon: 'success', duration: 2000}) wx.showLoading (OBJECT)

The basic library version 1.1.0 is supported, and the lower version needs to be compatible.

The loading prompt box is displayed. You need to call wx.hideLoading actively to close the prompt box.

OBJECT parameter description:

Parameter type is required to indicate whether titleString is prompted. Whether maskBoolean displays a transparent mask to prevent touch penetration. Default: falsesuccessFunction No API calls successful callback function failFunction No API calls failed callback function completeFunction No API calls the finished callback function (both successful and failed calls will be executed) wx.hideToast ()

Hide message prompt box

Wx.hideLoading ()

The basic library version 1.1.0 is supported, and the lower version needs to be compatible.

Hide the loading prompt box

Wx.showLoading ({title: 'loading',}) setTimeout (function () {wx.hideLoading ()}, 2000) wx.showModal (OBJECT)

Display mode pop-up window

OBJECT parameter description:

Parameter type is required to indicate that titleString is the title of the prompt contentString is the content of the prompt showCancelBoolean whether to display the cancel button, default is truecancelTextString no cancel button text, default is "cancel", up to 4 characters cancelColorHexColorNo cancel button text color, default is "# 000000" confirmTextString determines button text, default is "OK", up to 4 characters cancelHexColorNo determine button text color The default is "# 3CC51F" successFunction No API calls successful callback function failFunction No API calls failed callback function completeFunction No API calls the finished callback function (both successful and failed calls will be executed)

Succes return parameter description:

Parameter type description when the minimum version confirmBoolean is true, it means that when the user clicks the OK button cancelBoolean is true, the user clicks cancel (for Android systems to distinguish between clicking the mask to close or clicking the cancel button to close) 1.1.0

Sample code:

Wx.showModal ({title: 'prompt', content: 'this is a modal pop-up window', success: function (res) {if (res.confirm) {console.log ('user click OK')} else if (res.cancel) {console.log ('user click cancel')}) wx.showActionSheet (OBJECT)

Show Action menu

OBJECT parameter description:

The parameter type is required to indicate that itemListString Array is the text array of the button. The maximum length of the array is the text color of 6 itemColorHexColor No buttons. The default is "# 000000" successFunction No API calls the successful callback function. For more information, please see the return parameters indicating failFunction No API call failed callback function completeFunction No API call ended callback function (call will be executed successfully or failed)

Success return parameter description:

The parameter type describes the button clicked by the tapIndexNumber user, from top to bottom, starting with 0

Sample code:

Wx.showActionSheet ({itemList: ['Aids,' bones,'C'], success: function (res) {console.log (res.tapIndex)}, fail: function (res) {console.log (res.errMsg)}}) Bug & Tip

The confirm returned by bug:Android6.3.30,wx.showModal has always been true.

Tip: when wx.showActionSheet clicks cancel or mask, callback fail, errMsg is "showActionSheet:fail cancel"

Tip: only one wx.showLoading and wx.showToast can be displayed at the same time. You can close the prompt box by using wx.hideToast/wx.hideLoading.

Tip: iOS wx.showModal clicking on the mask will not close the modal pop-up window, so try to avoid using the "cancel" branch to implement business logic.

What does Mini Program mean? Mini Program is an application that can be used without download and installation. It can be used immediately by scanning a QR code or searching it. It is easy to operate and easy to spread. It can achieve seven major functions, such as message notification, offline code scanning, official account association, and so on. It is based on Wechat, similar to APP. You can use it whenever you want. After using it, you will leave without taking up memory.

Thank you for reading this. The editor hopes that you will have the most profound experience from the practical level on the key issue of "how to display the message prompt box in WeChat Mini Programs's development". If you want to read more related articles, you are welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report