Home >Web Front-end >uni-app >How uni-app performs synchronous requests

How uni-app performs synchronous requests

coldplay.xixi
coldplay.xixiOriginal
2020-12-08 15:59:5817290browse

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.

How uni-app performs synchronous requests

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

How uni-app performs synchronous requests

2. Then use request to make a request, as shown in the figure below

How uni-app performs synchronous requests

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

How uni-app performs synchronous requests

4. Then we use async with await, and then return Promise in the calling method, as shown in the figure below

How uni-app performs synchronous requests

5. After execution, you will see that the request becomes a synchronous request, as shown in the figure below

How uni-app performs synchronous requests

#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

How uni-app performs synchronous requests

#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

How uni-app performs synchronous requests

##Related free learning recommendations:

Programming Video

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn