当前位置:网站首页>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>
边栏推荐
- 如何选币与确定对应策略研究
- DFINITY 基金会创始人谈熊市沉浮,DeFi 项目该何去何从
- 第三章 : redis数据结构种类
- 开发常用手册链接分享
- 这份阿里强推的并发编程知识点笔记,将是你拿大厂offer的突破口
- Meteorological data processing example - matlab string cutting matching and R language date matching (data splicing)
- js劫持数组push方法
- Huawei's lightweight neural network architecture GhostNet has been upgraded again, and G-GhostNet (IJCV22) has shown its talents on the GPU
- 还在找网盘资源吗?快点收藏如下几个值得收藏的网盘资源搜索神器吧!
- STM32+ULN2003 drives 28BYJ4 stepper motor (forward and reverse according to the number of turns)
猜你喜欢
three.js调试工具dat.gui使用
用KUSTO查询语句(KQL)在Azure Data Explorer Database上查询LOG实战
基于MindSpore高效完成图像分割,实现Dice!
Jenkins manual (2) - software configuration
创建一个 Dapp,为什么要选择波卡?
012年通过修补_sss_提高扩散模型效率
单片机:温度控制DS18B20
Confessing in the era of digital transformation: Mai Cong Software allows enterprises to use data in the easiest way
还在找网盘资源吗?快点收藏如下几个值得收藏的网盘资源搜索神器吧!
High-quality DeFi application building guide to help developers enjoy DeFi Summer
随机推荐
This notebook of concurrent programming knowledge points strongly recommended by Ali will be a breakthrough for you to get an offer from a big factory
012年通过修补_sss_提高扩散模型效率
告白数字化转型时代:麦聪软件以最简单的方式让企业把数据用起来
The founder of the DFINITY Foundation talks about the ups and downs of the bear market, and where should DeFi projects go?
FPGA:开发环境Vivado的使用
Opencv算术操作
这份阿里强推的并发编程知识点笔记,将是你拿大厂offer的突破口
SQL外连接之交集、并集、差集查询
[Strong Net Cup 2022] WP-UM
E-sports, convenience, efficiency, security, key words for OriginOS functions
导火索:OAuth 2.0四种授权登录方式必读
Confessing in the era of digital transformation: Mai Cong Software allows enterprises to use data in the easiest way
电气工程的标准是什么
The JVM collection that Alibaba's top architects have summarized for many years, where can't I check it!
012_SSS_ Improving Diffusion Model Efficiency Through Patching
[强网杯2022]WP-UM
【 temperature warning program DE development 】 event driven model instance
第七章,activiti个人任务分配,动态指定和监听器指定任务委派人「建议收藏」
Complete image segmentation efficiently based on MindSpore and realize Dice!
js hijacks the array push method