This topic lists all APIs for mPaaS miniapps. For details, see the corresponding API reference.
Interface
Navigation bar
Name | Description |
|---|---|
Gets the background color of the navigation bar. | |
Hides the "Back to Home" icon on the title bar. | |
Hides the loading animation in the navigation bar on the current page. | |
Shows the loading animation in the navigation bar on the current page. | |
Sets the style of the navigation bar, including the title, background color, bottom border color, and the logo image in the upper-left corner. |
Tab bar
Name | Description |
|---|---|
Hides the tab bar. | |
Hides the red dot in the upper-right corner of a tab. | |
Removes the text from the upper-right corner of a tab. | |
Adds text to the upper-right corner of a tab. This can be used to display a notification dot with the number of unread messages. | |
Dynamically sets the content of a tab item. | |
Dynamically sets the overall style of the tab bar, such as text color, background color, and border color. | |
Displays tabs. | |
Shows the red dot in the upper-right corner of a tab. | |
Triggers when a tab is tapped. This can be used to listen for tab tap events. | |
Answers to frequently asked questions about the tab bar. |
Routing
Name | Description |
|---|---|
Switches to a specified tab bar page and closes all other non-tab bar pages. | |
Closes all current pages and navigates to a specified page in the application. | |
Closes the current page and navigates to a specified page in the application. | |
Navigates from the current page to a specified page in the application. | |
Closes the current page and returns to the previous page or a page multiple levels back. | |
Answers to frequently asked questions about routing. |
Interaction feedback
Name | Description |
|---|---|
Alerts | |
Displays a confirmation dialog box. | |
Displays a dialog box that prompts the user to enter text. | |
Shows a toast message that can disappear after a specified number of seconds. | |
Hides the hint text. | |
Shows a loading indicator. | |
Hides the loading indicator. | |
Shows an action sheet menu. |
Pull-to-refresh
Name | Description |
|---|---|
Listens for the pull-to-refresh event on the current page. | |
Stops the pull-to-refresh action on the current page. | |
Starts the pull-to-refresh action. |
Contacts
Name | Description |
|---|---|
Selects a contact's phone number from the local system's address book. |
Select city
Name | Description |
|---|---|
Opens the city selection list. | |
Defines a custom | |
Modifies the name of the default located city in |
Select date
Name | Description |
|---|---|
Opens the date picker. |
Animation
Name | Description |
|---|---|
Creates an animation instance. |
Canvas
Name | Description |
|---|---|
Creates a canvas drawing context. |
Keyboard
Name | Description |
|---|---|
Hides the keyboard. |
Scroll
Name | Description |
|---|---|
Scrolls the page to a target position. |
Node query
Name | Description |
|---|---|
Gets a |
Option selector
Name | Description |
|---|---|
A component similar to the native Safari select component, but with more features. It is often used as a replacement for the select component or for selecting two-level data. Note: Filter interaction between the two levels of data is not supported. |
Cascading selection
Name | Description |
|---|---|
Used for business scenarios that require multi-level cascading data selection, such as selecting a province, city, and district. |
Set background window
Name | Description |
|---|---|
Dynamically sets the background color of the window. | |
Dynamically sets the font and loading graphic style for the pull-down background. |
Set whether a page supports pull-down
Name | Description |
|---|---|
Sets whether a page supports the pull-down gesture. By default, pages in a miniapp support this gesture. |
Set optionMenu
Name | Description |
|---|---|
Configures an extra icon in the optionMenu of the navigation bar. Tapping the icon triggers |
Multimedia
Images
Name | Description |
|---|---|
Takes a photo or selects an image from the phone's album. | |
Previews an image. | |
Saves an online image to the phone's album. | |
Compresses an image. | |
Gets image information. |
Cache
Name | Description |
|---|---|
Stores data in the local cache with a specified key. This overwrites any existing data for that key. | |
Synchronously stores data in the local cache with a specified key. | |
Asynchronously gets cached data. | |
Synchronously gets cached data. | |
Asynchronously removes cached data. | |
Synchronously removes cached data. | |
Asynchronously clears the local data cache. | |
Synchronously clears the local data cache. | |
Asynchronously gets information about the current storage. | |
Synchronously gets information about the current storage. |
Files
Name | Description |
|---|---|
Saves a file to the local device. The total storage capacity for local files is 10 MB. | |
Gets file information. | |
Gets information about a saved file. | |
Gets a list of all saved files. | |
Deletes a saved file. |
Location
Name | Description |
|---|---|
Selects a geographical location using the built-in map. | |
Gets the user's current geographical location. | |
Views a location using the mPaaS miniapp's built-in map. |
Network
Name | Description |
|---|---|
Makes a network request from the miniapp. | |
Uploads a local resource to the developer's server. | |
Downloads a file resource to the local device. | |
Creates a WebSocket connection. | |
Listens for the WebSocket connection open event. | |
Stops listening for the WebSocket connection open event. | |
Listens for WebSocket errors. | |
Stops listening for WebSocket errors. | |
Sends data through the WebSocket connection. | |
Listens for messages received from the server over the WebSocket connection. | |
Stops listening for messages received from the server over the WebSocket connection. | |
Closes the WebSocket connection. | |
Listens for the WebSocket connection close event. | |
Stops listening for the WebSocket connection close event. |
Device
canIUse
Name | Description |
|---|---|
Checks if an API, input parameter, return value, component, or property is supported in the current version of the miniapp. |
Get base library version number
Name | Description |
|---|---|
Gets the version number of the base libraries. This value is for reference only. Do not base your code logic on this value. |
System info
Name | Description |
|---|---|
Gets mobile phone system information. | |
Synchronously gets mobile phone system information. |
Network status
Name | Description |
|---|---|
Gets the current network status. | |
Starts listening for changes in the network status. | |
Stops listening for changes in the network status. |
Clipboard
Name | Description |
|---|---|
Gets data from the clipboard. | |
Sets data on the clipboard. |
Shake
Name | Description |
|---|---|
Invokes the shake feature. Each time this API is called, a callback is triggered after the phone is shaken. To listen again, call this API again. |
Vibration
Name | Description |
|---|---|
Invokes the vibration feature. | |
Vibrates for a long duration (400 ms). | |
Vibrates for a short duration (40 ms). |
Accelerometer
Name | Description |
|---|---|
Listens for accelerometer data. | |
Stops listening for accelerometer data. |
Gyroscope
Name | Description |
|---|---|
Listens for gyroscope data change events. | |
Stops listening for gyroscope data. |
Compass
Name | Description |
|---|---|
Listens for compass data. | |
Stops listening for compass data. |
Make a phone call
Name | Description |
|---|---|
Makes a phone call. |
User screenshot event
Name | Description |
|---|---|
Listens for user-initiated screenshot events. | |
Stops listening for screenshot events. |
Screen brightness
Name | Description |
|---|---|
Sets whether to keep the screen on. | |
Gets the screen brightness. | |
Sets the screen brightness. |
Add a phone contact
Name | Description |
|---|---|
Lets a user save form data to the phone's address book by either creating a new contact or adding to an existing contact. |
Scan code
Name | Description |
|---|---|
Invokes the code scanning feature. |
Bluetooth
Name | Description |
|---|---|
Initializes the miniapp's Bluetooth module. | |
Closes the local device's Bluetooth module. | |
Gets the status of the local device's Bluetooth module. | |
Starts searching for nearby Bluetooth peripherals. | |
Stops searching for nearby Bluetooth peripherals. | |
Gets all discovered Bluetooth devices, including those already connected to the local device. | |
Gets all connected devices. | |
Connects to a Bluetooth Low Energy (BLE) device. | |
Disconnects from a BLE device. | |
Writes data to a BLE device's characteristic. | |
Reads data from a BLE device's characteristic. | |
Enables notifications for characteristic value changes on a BLE device. | |
Gets all services of a Bluetooth device. | |
Gets all characteristics of a Bluetooth device. | |
Triggers when a new Bluetooth device is found. | |
Stops listening for the new Bluetooth device found event. | |
Listens for characteristic value change events on a BLE device. | |
Stops listening for characteristic value change events on a BLE device. | |
Listens for BLE connection error events, such as device loss or abnormal disconnection. | |
Stops listening for BLE connection state change events. | |
Listens for changes in the local device's Bluetooth adapter state. | |
Stops listening for changes in the local device's Bluetooth adapter state. | |
A reference table of Bluetooth API error codes. |
Data security
Name | Description |
|---|---|
Asymmetric encryption. |
Share
Name | Description |
|---|---|
Defines the | |
Hides the share button. |
Miniapp current running version type
Name | Description |
|---|---|
Gets the current running version of the miniapp. |
Custom analytics
Name | Description |
|---|---|
An interface for reporting custom analytics data. |
Miniapp navigation
Name | Description |
|---|---|
Navigates to another miniapp. | |
Navigates back to the previous miniapp. This call is successful only if the current miniapp was launched from another miniapp. |
Web-view component control
Name | Description |
|---|---|
Creates and returns a | |
The |