// web-view
<web-view :src="pdfUrl"></web-view>
// 在onLoad中调用
// #ifdef APP-PLUS
this.setWebviewHeight()
// #endif
// methods方法
setWebviewHeight() {
// #ifdef APP-PLUS
let height = 0; //定义动态的高度变量,如高度为定值,可以直接写
uni.getSystemInfo({
//成功获取的回调函数,返回值为系统信息
success: sysinfo => {
height = sysinfo.windowHeight - 47; //自行修改,自己需要的高度
},
});
const currentWebview = this.$scope.$getAppWebview(); //获取当前web-view
setTimeout(function() {
const wv = currentWebview.children()[0];
wv.setStyle({
top: 50, //设置web-view距离顶部的距离以及自己的高度,单位为px
height: height
});
}, 1000); //如页面初始化调用需要写延迟
// #endif
}