Home > Article > Web Front-end > How uni-app performs synchronous requests
The method for uni-app to perform synchronous requests: first open Hbuilder to create a new default template of [uni-app]; then use request to make a request, and use async with await; then return Promise in the calling method; finally execute Later, you will see that the request becomes a synchronous request.
The operating environment of this tutorial: windows7 system, uni-app2.5.1 version, Dell G3 computer.
How uni-app performs synchronous requests:
1. First open Hbuilder and create a new default template for uni-app, as shown in the figure below
2. Then use request to make a request, as shown in the figure below
3. After running, you can see that the request has not been executed yet. The following statement is executed, 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 calling When the number of levels 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. The following two The operation will continue, as shown in the figure below
##Related free learning recommendations:
The above is the detailed content of How uni-app performs synchronous requests. For more information, please follow other related articles on the PHP Chinese website!