注意 web-view组件要放到最前,在其之前的代码的都会压住
<view class="container">
<!--webview 放到顶部,通过定位到党网联盟占位的地方,在其之前的代码要被压上 -->
<web-view src="++++++++++" class="wbp"></web-view>
<view class='indexPageHeader' id="indexPageHeader">
<view class="header-top-bg">
。。。。。。。。。。。。
<view v-else style="height: 70rpx;"></view>
</view>
<!-- webview在页面显示的位置 -->
<view class="viewholder-party">
<!-- 占位 webview 脱离文档流 要用占位 高度为对webview设置的高度 -->
</view>
async onReady(){
// #ifdef APP-PLUS
var currentWebview = this.$scope.$getAppWebview();
const query = uni.createSelectorQuery().in(this);
let topHeight = 0;
query.select('.header-top-bg').boundingClientRect(data => {
topHeight = data.height; // 头部元素高度
}).exec();
setTimeout(function() {
let wv = currentWebview.children()[0];
wv.setStyle({top:topHeight,height: 86})
}, 1000); //如果是页面初始化调用时,需要延时一下
// #endif
},