一、隐藏状态栏后,设置内容区距顶部的距离
// #ifdef APP-PLUS var winheight = 0; var barHeight = 0; uni.getSystemInfo({ //成功获取的回调函数,返回值为系统信息 success: sysinfo => { barHeight = sysinfo.statusBarHeight; // 状态栏高度 winheight = sysinfo.windowHeight; // win窗体高度 }, complete: () => {} }); var currentWebview = this.$scope.$getAppWebview(); //获取当前web-view setTimeout(function() { var wv = currentWebview.children()[0]; wv.setStyle({ //设置web-view距离顶部的距离以及自己的高度,单位为px top: barHeight, //此处是距离顶部的高度,应该是你页面的头部 height: winheight - barHeight, //webview的高度 scalable: true //webview的页面是否可以缩放,双指放大缩小 }); }, 1000); //如页面初始化调用需要写延迟 // #endif