y***@163.com
y***@163.com
  • 发布:2022-09-28 15:34
  • 更新:2022-09-28 16:56
  • 阅读:330

【报Bug】ios横屏,打开webview顶部有空白

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Mac

PC开发环境操作系统版本号: 12.6

手机系统: iOS

手机系统版本号: iOS 15

手机厂商: 模拟器

手机机型: iphone 14

页面类型: vue

vue版本: vue2

打包方式: 云端

项目创建方式: CLI

CLI版本号: 2.0.1-36420220922001

示例代码:

h5.vue

 <web-view src="/static/page/test/index.html" />

静态thml /static/page/test/index.html"

<!DOCTYPE html>  
<html lang="en">  
  <head>  
    <meta charset="UTF-8" />  
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />  
    <meta  
      name="viewport"  
      content="width=device-width, initial-scale=1.0, viewport-fit=cover"  
    />  
    <title>Document</title>  
    <style>  
      html,  
      body {  
        margin: 0;  
        padding: 0;  
      }  
      html {  
        border: 2px green solid;  
      }  
      body {  
        background-color: #eee;  
        border: 2px solid red;  
      }  
    </style>  
  </head>  
  <body>  
    aabc  
  </body>  
</html>

操作步骤:
  1. 打开h5.vue,正常显示页面
  2. IOS模拟器横屏,页面顶部有空白

预期结果:

页面顶部无空白

实际结果:

页面顶部有空白

bug描述:

ios横屏,打开webview顶部有空白,见附件

2022-09-28 15:34 负责人:无 分享
已邀请:
DCloud_UNI_WZF

DCloud_UNI_WZF

可尝试通过如下方式调整 webview top 值

const currentWebview = this.$scope.$getAppWebview() //获取当前页面的webview对象  
const wv = currentWebview.children()[0]  
wv.setStyle({top:uni.getWindowInfo().statusBarHeight+44})

要回复问题请先登录注册