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

What does WeChat Mini Programs api have?

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly introduces what WeChat Mini Programs api has, the article is very detailed, has a certain reference value, interested friends must read it!

API

The framework provides rich native API of Wechat, which can easily call up the capabilities provided by Wechat, such as access to user information, local storage, payment functions and so on.

Description:

The API at the beginning of wx.on is the API interface that listens for the occurrence of an event and accepts a CALLBACK function as an argument. When this event is triggered, the CALLBACK function is called.

If there is no special convention, other API interfaces accept an OBJECT as a parameter.

Success, fail and complete can be specified in OBJECT to receive the result of interface calls.

Required description for parameter name type

SuccessFunction No API calls a successful callback function

FailFunction No API calls a failed callback function

CompleteFunction No API calls the callback function that ends (both successful and failed calls will be executed)

API list:

Network API list:

API description

Wx.request initiates a network request

Wx.uploadFile uploads files

Wx.downloadFile download file

Wx.connectSocket creates a WebSocket connection

Wx.onSocketOpen snooping WebSocket on

Wx.onSocketError snooping WebSocket error

Wx.sendSocketMessage sends WebSocket messages

Wx.onSocketMessage accepts WebSocket messages

Wx.closeSocket closes WebSocket connection

Wx.onSocketClose snooping WebSocket off

Media API list:

API description

Wx.chooseImage selects a picture from an album or takes a picture

Wx.previewImage Preview Picture

Wx.startRecord, start recording.

Wx.stopRecord ends recording

Wx.playVoice plays voice

Wx.pauseVoice pauses voice playback

Wx.stopVoice ends voice playback

Wx.getBackgroundAudioPlayerState acquires music playback status

Wx.playBackgroundAudio plays music.

Wx.pauseBackgroundAudio pauses to play music

Wx.seekBackgroundAudio controls the progress of music playback

Wx.stopBackgroundAudio stops playing music

Wx.onBackgroundAudioPlay monitoring music starts to play

Wx.onBackgroundAudioPause monitor music pause

Wx.onBackgroundAudioStop monitoring music is over.

Wx.chooseVideo selects videos from photo albums or shoots them

List of files API:

API description

Wx.saveFile saves the file

Wx.getSavedFileList gets a list of saved files

Wx.getSavedFileInfo gets saved file information

Wx.removeSavedFile deletes saved file information

Wx.openDocument opens a file

Data API list:

API description

Wx.getStorage acquires local data cache

Wx.getStorageSync acquires local data cache

Wx.setStorage sets local data cache

Wx.setStorageSync sets local data cache

Wx.getStorageInfo acquires information about the local cache

Wx.getStorageInfoSync acquires information about the local cache

Wx.removeStorage deletes local cache content

Wx.removeStorageSync deletes local cache content

Wx.clearStorage cleans up local data cache

Wx.clearStorageSync cleans up local data cache

Location API list:

API description

Wx.getLocation gets the current location

Wx.chooseLocation opens the map to select a location

Wx.openLocation opens the built-in map

Wx.createMapContext Map component Control

Device API list:

API description

Wx.getNetworkType gets the network type

Wx.onNetworkStatusChange listens for network state changes

Wx.getSystemInfo acquires system information

Wx.getSystemInfoSync acquires system information

Wx.onAccelerometerChange monitoring acceleration data

Wx.startAccelerometer starts listening for acceleration data

Wx.stopAccelerometer stops listening for acceleration data

Wx.onCompassChange listens for compass data

Wx.startCompass starts listening to compass data

Wx.stopCompass stops listening to compass data

Wx.setClipboardData sets the clipboard contents

Wx.getClipboardData gets the clipboard contents

Wx.makePhoneCall makes a phone call

Wx.scanCode scan code

Interface API list:

API description

Wx.showToast display prompt box

Wx.showLoading displays the load prompt box

Wx.hideToast Hidden prompt Box

Wx.hideLoading Hidden prompt Box

Wx.showModal display mode pop-up window

Wx.showActionSheet display menu list

Wx.setNavigationBarTitle sets the current page title

Wx.showNavigationBarLoading display navigation bar load animation

Wx.hideNavigationBarLoading hide navigation bar load animation

Wx.navigateTo new window opens the page

The original window of wx.redirectTo opens the page

Wx.switchTab switches to the tabbar page

Wx.navigateBack returns to the previous page

Wx.createAnimation animation

Wx.createContext creates a drawing context

Wx.drawCanvas drawing

Wx.stopPullDownRefresh stops the drop down to refresh the animation

WXML Node Information API list:

API description

Wx.createSelectorQuery create query request

SelectorQuery.in specifies which custom component to select the node in

SelectorQuery.select selects a single node according to the selector

SelectorQuery.selectAll selects all nodes according to the selector

SelectorQuery.selectViewport Select display area

NodesRef.boundingClientRect gets layout location and size

NodesRef.scrollOffset gets the scrolling position

NodesRef.fields gets any field

SelectorQuery.exec executes query request

WXML node layout intersection status:

API description

Wx.createIntersectionObserver creates IntersectionObserver object

IntersectionObserver.relativeTo specifies the reference node

IntersectionObserver.relativeToViewport specifies the page display area as the reference area

IntersectionObserver.observe specifies the target node and starts listening

IntersectionObserver.disconnect stops snooping

Open interface:

API description

Wx.login login

Wx.getUserInfo acquires user information

Wx.chooseAddress obtains the receiving address of the user

Wx.requestPayment launched WeChat Pay

Wx.addCard add card coupon

Wx.openCard opens the card coupon

The above is all the contents of the article "what does WeChat Mini Programs api have?" Thank you for reading! Hope to share the content to help you, more related knowledge, 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