notitle_webview.vue 1.5 KB
<template>
	<view>
		<customWebview :src="url" :top="webview_top" :height="webview_height"></customWebview>
	</view>
</template>

<script>
	import customWebview from '../../components/customWebview.vue'
	import {
		default as app_config
	} from '@/utils/app.js';
	import common from '@/utils/common.js'
	var wv; //计划创建的webview
	export default {
		components: {
			customWebview
		},
		data() {
			return {
				url: '',
				webview_top: 0,
				webview_height: uni.getSystemInfoSync().windowHeight,
			}
		},
		methods: {

		},
		onLoad(val) {
			let data = JSON.parse(decodeURIComponent(val.info))
			this.url = data.url
			if (data.title) {
				uni.setNavigationBarTitle({
					title: data.title
				})
			}
			if (uni.getSystemInfoSync().platform == "ios") {
				/*
				  获取顶部安全区域的高度 安卓的顶部区域为0 ios的是实际大小
				*/
				let safeTopArea = uni.getSystemInfoSync().platform == 'ios' ? uni.getSystemInfoSync().safeAreaInsets.top :
					0;
				//获取底部安全区域的高度
				let safeBoottom = uni.getSystemInfoSync().safeAreaInsets.bottom;
				
				this.webview_top = - safeTopArea
				this.webview_height = uni.getSystemInfoSync().windowHeight + safeBoottom + safeTopArea
				console.log(this.webview_top)
			} else {
				
				this.webview_top = common.customBarH + uni.getSystemInfoSync().navigationBarHeight,
				this.webview_height = uni.getSystemInfoSync().windowHeight
			}
		},
		onReady() {
			
			
		},
		methods : {
			
		}
	}
</script>

<style>

</style>