You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.1 KiB
44 lines
1.1 KiB
<template>
|
|
<view class="pageBg">
|
|
<web-view :src="link" :webview-styles="webviewStyles" :update-title="false"></web-view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
let wv
|
|
export default {
|
|
data() {
|
|
return {
|
|
webviewStyles: {
|
|
progress: {
|
|
color: '#3877ff'
|
|
},
|
|
},
|
|
link: ''
|
|
}
|
|
},
|
|
onLoad() {
|
|
this.link = this.$store.state.webViewUrl
|
|
console.log('webview地址'+ this.$store.state.webViewUrl)
|
|
},
|
|
onReady() {
|
|
let statusBar = uni.getWindowInfo().statusBarHeight
|
|
// #ifdef APP-PLUS
|
|
let boxHeight = 0
|
|
uni.getSystemInfo({
|
|
success: res => boxHeight = res.windowHeight // 屏幕可用高度
|
|
})
|
|
var currentWebview = this.$scope
|
|
.$getAppWebview() //此对象相当于html5plus里的plus.webview.currentWebview()。在uni-app里vue页面直接使用plus.webview.currentWebview()无效
|
|
setTimeout(function() {
|
|
wv = currentWebview.children()[0]
|
|
wv.setStyle({
|
|
top: statusBar,
|
|
height: boxHeight - statusBar
|
|
})
|
|
}, 1000); //如果是页面初始化调用时,需要延时一下
|
|
// #endif
|
|
}
|
|
}
|
|
</script>
|
|
|