devicestate.vue
1.37 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
<template>
<div class="manage-container device-log-wrapper">
<iframe
:src="devLogUrl"
width="100%"
:height="iframeHeight"
frameborder="0"
name="device_log"
class="log-iframe"></iframe>
</div>
</template>
<script>
export default {
data() {
return {
devLogUrl: '',
iframeHeight: 0,
}
},
created() {
this.iframeHeight = this.computedHeight('px');
window.addEventListener('resize', () => {
this.iframeHeight = this.computedHeight('px');
})
this.devLogUrl = window._vionConfig.logUrl;
},
mounted() {
this.devLogUrl = window._vionConfig.logUrl;
},
methods: {
computedHeight(unit) {
let computedH = 0
, winH = $(window).height()
, scale = 0.16;
if(winH <= 720) {
scale = 0.18
} else if (winH <= 768) {
scale = 0.17
} else if (winH <= 900) {
scale = 0.17
} else if (winH <= 1080) {
scale = 0.16
}
computedH = winH - winH * scale;
computedH = unit ? computedH + unit : computedH;
return computedH;
}
}
}
</script>
<style scoped>
.log-iframe {
margin-top: 10px;
}
</style>