May 18, 2021 WeChat Mini Program Development Document
The framework provides a wealth of WeChat native APIs that can easily adjust the capabilities provided by WeChat, such as access to user information, local storage, payment functions, etc.
Description:
The name of the argument | Type | Required | Description |
---|---|---|---|
success | Function | Whether | The interface calls a successful callback function |
fail | Function | Whether | The interface calls the failed callback function |
complete | Function | Whether | Callback function at end of interface call (call succeeds, fails are executed) |
List of APIs:
List of network APIs:
Api | Description |
---|---|
wx.request | Make a network request |
wx.uploadFile | Upload the file |
wx.downloadFile | Download the file |
wx.connectSocket | Create a WebSocket connection |
wx.onSocketOpen | Listen to WebSocket open |
wx.onSocketError | Listen for WebSocket errors |
wx.sendSocketMessage | Send a WebSocket message |
wx.onSocketMessage | Accept the WebSocket message |
wx.closeSocket | Close the WebSocket connection |
wx.onSocketClose | Listen to WebSocket off |
List of media APIs:
Api | Description |
---|---|
wx.chooseImage | Select a picture from an album, or take a photo |
wx.previewImage | Preview the picture |
wx.startRecord | Start recording |
wx.stopRecord | End the recording |
wx.playVoice | Play the voice |
wx.pauseVoice | Pause Play voice |
wx.stopVoice | End play voice |
wx.getBackgroundAudioPlayerState | Get music playback status |
wx.playBackgroundAudio | play music |
wx.pauseBackgroundAudio | Pause play music |
wx.seekBackgroundAudio | Control music play progress |
wx.stopBackgroundAudio | Stop playing music |
wx.onBackgroundAudioPlay | Listening to music start playing |
wx.onBackgroundAudioPause | Monitoring music pause |
wx.onBackgroundAudioStop | Listening to music |
wx.chooseVideo | Select video from album, or shoot |
File API list:
API | illustrate |
---|---|
wx.saveFile | save document |
wx.getSavedFileList | Get list of saved files |
wx.getSavedFileInfo | Get saved file information |
wx.removeSavedFile | Delete saved file information |
wx.openDocument | Open the file |
List of data APIs:
Api | Description |
---|---|
wx.getStorage | Gets the local data cache |
wx.getStorageSync | Gets the local data cache |
wx.setStorage | Set up a local data cache |
wx.setStorageSync | Set up a local data cache |
wx.getStorageInfo | Get information about the local cache |
wx.getStorageInfoSync | Get information about the local cache |
wx.removeStorage | Delete local cached content |
wx.removeStorageSync | Delete local cached content |
wx.clearStorage | Clean up the local data cache |
wx.clearStorageSync | Clean up the local data cache |
Location API list:
Api | Description |
---|---|
wx.getLocation | Gets the current location |
wx.chooseLocation | Open the map to select a location |
wx.openLocation | Open the built-in map |
wx.createMapContext | Map component control |
List of device APIs:
Api | Description |
---|---|
wx.getNetworkType | Gets the network type |
wx.onNetworkStatusChange | Listen for changes in network status |
wx.getSystemInfo | Get system information |
wx.getSystemInfoSync | Get system information |
wx.onAccelerometerChange | Listen for acceleration data |
wx.startAccelerometer | Start listening for acceleration data |
wx.stopAccelerometer | Stop listening for acceleration data |
wx.onCompassChange | Listen for aross data |
wx.startCompass | Start listening to the arospass data |
wx.stopCompass | Stop listening to the arospass data |
wx.setClipboardData | Set the clipboard content |
wx.getClipboardData | Get the clipboard content |
wx.makePhoneCall | Dial number |
wx.scanCode | Sweep the code |
List of interface APIs:
Api | Description |
---|---|
wx.showToast | Show the prompt box |
wx.showLoading | Displays the load prompt box |
wx.hideToast | Hide the prompt box |
wx.hideLoading | Hide the prompt box |
wx.showModal | Show modal spring windows |
wx.showActionSheet | Displays a list of menus |
wx.setNavigationBarTitle | Set the current page title |
wx.showNavigationBarLoading | Displays an animation of the navigation bar loading |
wx.hideNavigationBarLoading | Hide the navigation bar loading animation |
wx.navigateTo | A new window opens the page |
wx.redirectTo | The original window opens the page |
wx.switchTab | Switch to the tabbar page |
wx.navigateBack | Go back to the last page |
wx.createAnimation | Animation |
wx.createCanvasContext | Create a drawing context |
wx.drawCanvas | Drawing |
wx.stopPullDownRefresh | Stop the pull-down refresh animation |
List of WXML node information APIs:
Api | Description |
---|---|
wx.createSelectorQuery | Create a query request |
selectorQuery.select | Select a single node based on the selector |
selectorQuery.selectAll | Select all nodes based on the selector |
selectorQuery.selectViewport | Select the display area |
nodesRef.boundingClientRect | Gets the layout position and dimensions |
nodesRef.scrollOffset | Gets the scrolling position |
nodesRef.fields | Get any field |
selectorQuery.exec | The query request is executed |
Open interface:
Api | Description |
---|---|
wx.login | Login |
wx.getUserInfo | Get user information |
wx.chooseAddress | Get the user's shipping address |
wx.requestPayment | Start WeChat payment |
wx.addCard | Add a voucher |
wx.openCard | Open the voucher |