微信小程序获取屏幕高度和宽度,并在视图层使用

时间:2019-11-10 01:17:31   收藏:0   阅读:143
逻辑层获取屏幕宽高:
 
//获取屏幕高度
this.setData({
height: wx.getSystemInfoSync().windowHeight,  //屏幕高度
width:wx.getSystemInfoSync().windowWidth  //屏幕宽度
})
 
视图层使用:
 
<view class="page" style="height:{{height}}px">
 
</view>

原文:https://www.cnblogs.com/P201721440036/p/11828327.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!