<template>
	<view class="pageBg">
		<web-view :src="usecarStore.webLink" :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>

