小少年报
小少年报
  • 发布:2020-08-04 18:47
  • 更新:2020-08-04 18:47
  • 阅读:1648

webview会自动铺满,解决占领手机状态栏

分类:uni-app

在webview的page页面中,created()生命周期中,
// #ifdef APP-PLUS
var currentWebview = this.$mp.page.$getAppWebview(); //获取当前web-view
setTimeout(function() {
var wv = currentWebview.children()[0];
wv.setStyle({ //设置web-view距离顶部的距离以及自己的高度,单位为px
top: uni.getSystemInfoSync().statusBarHeight,
})
}, 1000);
// #endif

0 关注 分享

要回复文章请先登录注册