uniapp 自适应问题

状态栏
官网给出的解决办法 --status-bar-height

<view class="status_bar"><!--这里是状态栏--></view>
<style lang="stylus">
	/*每个页面公共css */
	.status_bar
		height var(--status-bar-height)
		width 100%
</style>

css的height高度问题
可以用 calc属性进行运算 height calc(100% -20rpx)

自动获取 手机屏幕 高度
思路
先获取手机品屏幕高度 - 状态了高

uni.getSystemInfo({
	success:(res)=>{
	  console.log(`height: ${res.windowHeight*2}rxp`)
	}
})

版权声明:本文为zy_mofeimo原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。