Home  >  Article  >  Web Front-end  >  How to get the screen height in uniapp

How to get the screen height in uniapp

coldplay.xixi
coldplay.xixiOriginal
2020-12-15 16:57:4017841browse

How uniapp gets the screen height: First create a new [uni-app] project and find the onLoad method; then write the [uni.getSystemInfo] method and prepare the width and height variables; finally assign the screen width and height to the variables.

How to get the screen height in uniapp

The operating environment of this tutorial: windows7 system, uni-app2.5.1 version. This method is suitable for all brands of computers.

Recommended (free): uni-app development tutorial

Uniapp method to get the screen height:

1. Create a new uni-app project, as shown in the figure below

How to get the screen height in uniapp

2. Find the onLoad method, as shown in the figure below

How to get the screen height in uniapp

3. Write the uni.getSystemInfo method, as shown in the figure below

How to get the screen height in uniapp

4. Prepare the width and height Variables, as shown in the figure below

How to get the screen height in uniapp

5. Assign the screen width and height to variables, as shown in the figure below

How to get the screen height in uniapp

6. Finally, you can also print the res and take a look at the content inside, as shown in the picture below

How to get the screen height in uniapp

##Related free learning recommendations:

php Programming(video)

The above is the detailed content of How to get the screen height in uniapp. 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