uniapp webview页预留顶部安全位置

发布时间 2023-11-22 16:46:30作者: huihuihero
onLoad(){
  // #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
}