资讯动态

【uniapp】解决H5嵌套在web-view中时打包页面与状态栏重叠

发布时间:2026/10/2 22:08:55 来源:尧图企业网站定制
问题当H5嵌套在web-view中打包后的app打开后的页面的导航栏与手机状态栏重叠根据官方文档App端web-view的扩展解决方案templateviewweb-viewrefwebview:srcpathmessagemessage//view/templateonLoad(e){constdateTimenewDate()this.pathhttps://xxxx.com/?t${dateTime.getTime()}#/this.$nextTick((){currentWebviewthis.$scope.$getAppWebview()setTimeout(function(){varwvcurrentWebview.children()[0]wv.setStyle({// 设置web-view距离顶部的距离以及自己的高度单位为pxtop:42// 距离顶部的高度bottom:0,//防止输入框被软键盘遮挡、防止底部tabbar被遮挡// height:height,//webview的高度})},1000)// 如果是首页的onload调用时需要延时一下二级页面无需延时可直接获取})},

读完文章,也想定制专属网站?

尧图设计师 24 小时内与您沟通定制方案

免费获取报价 →
↑