uni-app embeds webView in the component, realizes customizing the size of webView, and handles the problem that click events of other elements fail when there is webview in the page
uni-app embeds webView in the component to realize the size of custom webView
setWebviewTop() {
// #ifdef APP-PLUS
var currentWebview = this.$scope.$getAppWebview()
setTimeout(function() {
let wv = currentWebview.children()[0]
wv.setStyle({
top: 150
})
}, 1000); //如果是页面初始化调用时,需要延时一下
// #endif
},
When there is a webview in the page, the click event of other elements fails
The webView package layer box is set to fixed positioning to empty the above content.
<view class="web-view-wrap">
<web-view :src="webviewUrl" @message="handleMessage" :update-title="false"></web-view>
</view>
.web-view-wrap {
position: fixed;
top: 280px;
}