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

时间:2019-11-09 23:50:23   收藏:0   阅读:130
逻辑层获取屏幕宽高:
 
//获取屏幕高度
this.setData({
height: wx.getSystemInfoSync().windowHeight,  //屏幕高度
width:wx.getSystemInfoSync().windowWidth  //屏幕宽度
})
 
视图层使用:
 
<view class="page" style="height:{{height}}px">
 
</view>
评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!