当前位置:网站首页>uniapp中的view高度设置100%
uniapp中的view高度设置100%
2022-08-05 10:26:00 【spring-java】
1、在APP.vue文件添加如下代码
<script>
export default {
data() {
return {
globalData: {},
}
},
onLaunch: function() {
console.log('App Launch')
uni.getSystemInfo({ //设置屏幕高度
success: res => {
//减去tabbar的高度,默认为50px
this.globalData.screenHeight = res.screenHeight;
this.globalData.screenWidth = res.screenWidth;
}
})
},
onShow: function() {
console.log('App Show')
},
onHide: function() {
console.log('App Hide')
}
}
</script>
<style lang="scss">
/*每个页面公共css */
@import "@/uni_modules/uview-ui/index.scss";
</style>
2、在组件中设置页面高度
<template>
<view>
<view class="barClass" :style="'height:'+screenHeight+'px'">左分页</view>
<view style="width: 70%;float: left;">右分页</view>
</view>
</template>
<script>
export default {
data() {
return {
screenHeight: getApp().globalData.screenHeight
}
},
onShow() {
plus.screen.lockOrientation('landscape-primary');
plus.navigator.setFullscreen(true)
},
onUnload() {
plus.screen.lockOrientation('portrait-primary')
plus.navigator.setFullscreen(false)
},
methods: {
}
}
</script>
<style lang="scss" scoped>
.barClass {
width: 30%;
float: left;
background-color: #000000;
}
</style>
边栏推荐
- NowCoderTOP35-40 - continuous update ing
- Is digital transformation a business buy-in?
- Go编译原理系列6(类型检查)
- 一个栈的输入序列为1 2 3 4 5 的出站顺序的理解
- Technical dry goods | Hausdorff distance for image segmentation based on MindSpore
- Go compilation principle series 6 (type checking)
- linux下oracle常见操作以及日常积累知识点(函数、定时任务)
- 012_SSS_ Improving Diffusion Model Efficiency Through Patching
- 如何选币与确定对应策略研究
- SQL外连接之交集、并集、差集查询
猜你喜欢

First Decentralized Heist?Loss of nearly 200 million US dollars: analysis of the attack on the cross-chain bridge Nomad

单片机:温度控制DS18B20

Login function and logout function (St. Regis Takeaway)

Data Middle Office Construction (10): Data Security Management

Meteorological data processing example - matlab string cutting matching and R language date matching (data splicing)

SQL Outer Join Intersection, Union, Difference Query

SQL外连接之交集、并集、差集查询

three objects are arranged in a spherical shape around the circumference

如何选币与确定对应策略研究

产品太多了,如何实现一次登录多产品互通?
随机推荐
PHP 操作mangoDb
语音社交软件开发——充分发挥其价值
three.js debugging tool dat.gui use
[Android] How to use RecycleView in Kotlin project
【MindSpore易点通机器人-01】你也许见过很多知识问答机器人,但这个有点不一样
[Translation] Chaos Net + SkyWalking: Better observability for chaos engineering
Chapter 4: In the activiti process, variable transmission and acquisition process variables, setting and acquiring multiple process variables, setting and acquiring local process variables "recommende
第九章:activit内置用户组设计与组任务分配和IdentityService接口的使用
JS逆向入门学习之回收商网,手机号码简易加密解析
第四章:activiti RuntimeService设置获和取流程变量,及与taskService的区别,开始和完成任务时设置流程变量[通俗易懂]
First Decentralized Heist?Loss of nearly 200 million US dollars: analysis of the attack on the cross-chain bridge Nomad
你最隐秘的性格在哪?
How does the official account operate and maintain?Public account operation and maintenance professional team
第五章:activiti流程分流判断,判断走不同的任务节点
开发常用手册链接分享
GCC编译的时候头文件搜索规则
In-depth understanding of timeout settings for Istio traffic management
电气工程的标准是什么
STM32+ULN2003 drives 28BYJ4 stepper motor (forward and reverse according to the number of turns)
nyoj86 找球号(一) set容器和二分 两种解法