Mini Program Hosting Environment - API

Mini Program Hosting Environment - API

Mini Program API Overview

The APIs in Mini Programs are provided by the host environment. Through these rich Mini Program APIs, developers can easily call the capabilities provided by WeChat, such as: obtaining user information, local storage, payment functions, etc.

Three categories of Mini Program APIs

The applet officially divides the API into the following three categories:
① Event monitoring API
● Features: start with on, used to monitor the triggering of certain events
● Example: wx.onWindowResize(function callback) monitor window size change events
② Synchronous API
●Feature 1: APIs ending with Sync are all synchronous APIs
●Feature 2: The execution result of the synchronous API can be obtained directly through the return value of the function, and an exception will be thrown if the execution fails ● Example: wx.setStorageSync('key', ' value') into local storage
③ Asynchronous API
Features: Similar to the $.ajax(options) function in jQuery, it needs to receive call results through success, fail, and complete
Example: wx.request() initiates a network Data request, receive data through success callback function

Guess you like

Origin blog.csdn.net/qq_44255741/article/details/127372998