微信小程序——自动适配屏幕高度与宽度

it2023-06-28  84

wxml文件

<view class="page" style="height:{{windowHeight * 2}}rpx"></view>

js文件

data: { windowHeight: 0 } onLoad: function (options) { const that = this wx.getSystemInfo({ success(res) { that.setData({ windowHeight: res.windowHeight // 宽度为res.windowWidth }) } }) }
最新回复(0)