<view :style="'height: '+(phoneHeight)+'rpx;'">
data() {
return {
phoneHeight: 0,//屏幕高度
}
},
onLoad(){
// 获取屏幕高度
let self = this;
uni.getSystemInfo({
success(res) {
console.log(res.screenHeight); //屏幕高度 注意这里获得的高度宽度都是px 需要转换rpx
console.log(res.windowWidth); //可使用窗口宽度
console.log(res.windowHeight); //可使用窗口高度
console.log(res.screenWidth); //屏幕宽度
self.phoneHeight = (res.screenHeight * (750 / res.windowWidth))//窗口高度,将px 转换rpx
}
});
},