tencent cloud

Tencent Cloud Super App as a Service

Release Notes and Announcements
Announcement: Tencent Cloud Mini Program Platform Renamed to Tencent Cloud Super App as a Service on January 2, 2025
Console Updates
Android SDK Updates
iOS SDK Updates
Flutter SDK Updates
IDE Updates
Base Library Updates
Product Introduction
Overview
Strengths
Use Cases
Purchase Guide
Billing Overview
Pay-As-You-Go Billing
Renewal Guide
Service Suspension Instructions
Getting Started
Plan Management
Overview
Console Account Management
Storage Configuration
Acceleration Configuration
Branding Configurations
Platform Features
Console Login
Users and Permission System
Mini Program Management
Mini Game Management
Superapp Management
Commercialization
Platform Management
User Management
Team Management
Operations Management
Security Center
Code Integration Guide
Getting Demo and SDK
Android
iOS
Flutter
Superapp Server
GUID Generation Rules
Mini Program Development Guide
Mini Program Introduction and Development Environment
Mini Program Code Composition
Guide
Framework
Components
API
Server Backend
JS SDK
Base Library
IDE Operation Instructions
Mini Game Development Guide
Guide
API
Server Backend
Practice Tutorial
Mini Program Login Practical Tutorial
Mini Program Subscription Message Practical Tutorial
Payment Practical Tutorial
Ad Integration Practical Tutorial
Mini Game Subscription Message Practical Tutorial
API Documentation
History
Introduction
API Category
Making API Requests
Operation Management APIs
User Management APIs
Team Management APIs
Sensitive API-Related APIs
Role Management APIs
Platform Management APIs
Other Console APIs
Mini Program or Mini Game APIs
Management-Sensitive APIs
Global Domain Management APIs
Superapp APIs
Data Types
Agreements
Service Level Agreement
Data Processing and Security Agreement
SDK Privacy Policy Module
SDK Data Processing and Security Agreement Module

Interaction

PDF
Focus Mode
Font Size
Last updated: 2025-04-10 18:18:33

hideLoading

This API is called using wx.hideLoading(Object object).
Feature description:Hides the loading prompt box.
Parameter and description:Object object.
Property
Type
Default value
‍Required
Description
noConflict
boolean
false
False
Currently, toast and loading related APIs can be used interchangeably. This parameter can be used to cancel this feature.
success
function
-
False
Callback function for successful API calls.
fail
function
-
False
Callback function for failed API calls.
complete
function
-
False
Callback function executed after API call ends (regardless of success or failure).

hideToast

This API is called using wx.hideToast(Object object).
Feature description:Hides the message prompt box.
Parameter and description:Object object.
Property
Type
Default value
‍Required
Description
noConflict
boolean
false
False
Currently, toast and loading related APIs can be used interchangeably. This parameter can be used to cancel this feature.
success
function
-
False
Callback function for successful API calls.
fail
function
-
False
Callback function for failed API calls.
complete
function
-
False
Callback function executed after API call ends (regardless of success or failure).

showActionSheet

This API is called using wx.showActionSheet(Object object).
Notes:
For Android versions earlier than 6.7.2, tapping cancel or the mask will trigger the fail callback with errMsg as "fail cancel".
For Android 6.7.2 and later, and iOS, tapping the mask will not close the modal popup. In the fail callback function, if errMsg is "fail cancel", it is not recommended to implement business logic in this scenario.
Feature description:Shows the action menu.
Parameter and description:Object object.
Property
Type
Default value
‍Required
Description
itemList
array.<string>
-
True
Array of button text, with a maximum length of 6.
itemColor
string
#000000
False
Button text color.
success
function
-
False
Callback function for successful API calls.
fail
function
-
False
Callback function for failed API calls.
complete
function
-
False
Callback function executed after API call ends (regardless of success or failure).
object.success callback function parameter:Object res
Property
Type
Description
tapIndex
number
The index of the button tapped by the user, starting from 0.
Example:
wx.showActionSheet({
itemList: ['A', 'B', 'C'],
success (res) {
console.log(res.tapIndex)
},
fail (res) {
console.log(res.errMsg)
}
})

showLoading

This API is called using wx.showLoading(Object object).
Feature description:Shows the loading prompt box. You need to call wx.hideLoading to close the prompt box.
Parameter and description:Object object.
Property
Type
Default value
‍Required
Description
title
string
-
True
The content of the prompt.
mask
boolean
false
False
Whether to show a transparent mask to prevent touch penetration.
success
function
-
False
Callback function for successful API calls.
fail
function
-
False
Callback function for failed API calls.
complete
function
-
False
Callback function executed after API call ends (regardless of success or failure).
Example:
wx.showLoading({
title: 'Loading',
})

setTimeout(function () {
wx.hideLoading()
}, 2000)
Notes:
wx.showLoading and wx.showToast cannot be shown at the same time.
wx.showLoading should be used with wx.hideLoading.

showModal

This API is called using is wx.showModal(Object object).
Notes:
For Android versions earlier than 6.7.2, tapping cancel or the mask will trigger the fail callback with errMsg as "fail cancel".
For Android 6.7.2 and later, and iOS, tapping the mask will not close the modal popup. In the fail callback function, if errMsg is "fail cancel", it is not recommended to implement business logic in this scenario.
Feature description:Shows the modal dialog box.
Parameter and description:Object object.
Property
Type
Default value
‍Required
Description
title
string
-
False
The title of the prompt.
content
string
-
False
The content of the prompt.
showCancel
boolean
true
False
Whether to show the Cancel button.
cancelText
string
Cancel
False
The text of the Cancel button, which can contain up to four characters.
cancelColor
string
#000000
False
The color of the Cancel button text, must be a hexadecimal color string.
confirmText
string
OK
False
The text of the OK button, which can contain up to four characters.
confirmColor
string
#576B95
False
The color of the OK button text, must be a hexadecimal color string.
success
function
-
False
Callback function for successful API calls.
fail
function
-
False
Callback function for failed API calls.
complete
function
-
False
Callback function executed after API call ends (regardless of success or failure).
object.success callback function parameter:Object res
Property
Type
Description
confirm
boolean
true if the user tapped the OK button.
cancel
boolean
true if the user tapped the Cancel button (used to distinguish between tapping the mask to close or tapping the Cancel button on Android).
Example:
wx.showModal({
title: 'Prompt',
content: 'This is a modal pop-up',
success (res) {
if (res.confirm) {
console.log('The user taps OK')
} else if (res.cancel) {
console.log('The user taps Cancel')
}
}
})

showToast

This API is called using wx.showToast(Object object).
Feature description:Shows the message prompt box.
Parameter and description:Object object.
Property
Type
Default value
‍Required
Description
title
string
-
True
The content of the prompt.
icon
string
success
False
Icon. Valid values:
success: Shows a success icon, with a maximum of seven characters for the title.
error: Shows a failure icon, with a maximum of seven characters for the title.
loading: Shows a loading icon, with a maximum of seven characters for the title.
none: No icon is displayed, and the title can display up to two lines.
image
string
-
False
The local path to a custom icon. The image has a higher priority than icon.
duration
number
1500
False
The duration of the prompt in milliseconds.
mask
boolean
false
False
Whether to show a transparent mask to prevent touch penetration.
success
function
-
False
Callback function for successful API calls.
fail
function
-
False
Callback function for failed API calls.
complete
function
-
False
Callback function executed after API call ends (regardless of success or failure).
Example:
wx.showToast({
title: 'Success',
icon: 'success',
duration: 2000
})
Notes:
wx.showLoading and wx.showToast cannot be shown at the same time.
wx.showLoading should be used with wx.hideLoading.

enableAlertBeforeUnload

This API is called using wx.enableAlertBeforeUnload(Object object).
Notes:
This API is supported in mini programs but not in mini games.
Feature description:Enables a confirmation dialog when the user tries to navigate away from a page in the mini program.
Conditions for showing the dialog box:
When the user is on a non-home page or the bottom-most page in the mini program.
When using the official navigation bar's back button.
When using a custom back button in full-screen mode.
When pressing the back button on an Android device.
Notes:
This feature does not intercept swipe gestures for navigation.
In any scenario, this feature should not prevent the user from exiting the mini program.
Parameter and description:Object object.
Property
Type
Default value
‍Required
Description
message
string
-
True
The content of the confirmation dialog.
success
function
-
False
Callback function for successful API calls.
fail
function
-
False
Callback function for failed API calls.
complete
function
-
False
Callback function executed after API call ends (regardless of success or failure).

disableAlertBeforeUnload

This API is called using wx.disableAlertBeforeUnload(Object object).
Notes:
This API is supported in mini programs but not in mini games.
Feature description:Disables the confirmation dialog when the user tries to navigate away from a page in the mini program.
Parameter and description:Object object.
Property
Type
Default value
‍Required
Description
success
function
-
False
Callback function for successful API calls.
fail
function
-
False
Callback function for failed API calls.
complete
function
-
False
Callback function executed after API call ends (regardless of success or failure).



Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback