Uniapp sets up synchronous and asynchronous methods: first open Hbuilder to create a new default template of uni-app, and use request to make a request; then use async with await, and return Promise in the calling method; finally after execution, you will see request becomes a synchronous request.
The operating environment of this tutorial: windows7 system, uni-app2.5.1 version, thinkpad t480 computer.
Recommended (free): uni-app development tutorial
Uniapp settings synchronous and asynchronous methods:
1. First open Hbuilder and create a new default template of uni-app, as shown in the figure below
2. Then use request Make a request, as shown in the figure below
3. After running, you can see that the following statement is executed before the request is completed, as shown in the figure below
4. Then we use async with await, and then return Promise in the calling method, as shown in the figure below
5. After execution You will see that the request becomes a synchronous request, as shown in the figure below
##6. In addition, when the number of calls increases, you need to increase async and await step by step. As shown in the figure below
#7. After the final execution, you can see that the request request has been completed, and the following two operations will continue, as shown in the figure below
Related free learning recommendations: Programming Video
The above is the detailed content of How to set up synchronization and asynchronousness in uniapp. For more information, please follow other related articles on the PHP Chinese website!