// #ifdef APP-PLUS
var height = 0;
uni.getSystemInfo({
success: (sysinfo) => {
height = sysinfo.windowHeight;
},
complete: () => {}
});
var currentWebview = this.$scope.$getAppWebview();
setTimeout(function() {
this.barHeight = plus.navigator.getStatusbarHeight();
var wv = currentWebview.children()[0];
wv.setStyle({
top: this.barHeight,
height: height - this.barHeight,
scalable: true,
})
}, 500);
// #endif
uniapp,web-view在app上预留顶部安全位置,距离头部位置
文章介绍了如何在uni-app中使用JavaScript获取设备窗口高度和状态栏高度,以实现webview的高度动态调整,确保在iOS和Android平台上的适配。

被折叠的 条评论
为什么被折叠?



