notitle_webview.vue
1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<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>