<!-- * @Description: 右半屏 1411,各专项大屏 * @Author: 王晓颖 * @Date: 2021-01-20 11:20:11 --> <template> <div ref="container" class="container"> <div ref="body" class="body"> <div class="frame-div"> <iframe :src="currentScreen" scrolling="no" frameborder="0"/> </div> </div> </div> </template> <script> export default { name: 'RightScreen', data() { return { currentScreen: 'http://11.100.6.135:18080/rjzhsq/operationMonitor' } }, mounted() { const that = this // this.calSize() window.onload = () => { that.calSize() } window.onresize = () => { that.calSize() } }, methods: { calSize() { // const height = document.body.clientHeight const height = this.$refs.container.offsetHeight const headerHeight = this.$refs.header.$el.clientHeight const bodyHeight = height - headerHeight this.$refs.body.style.height = bodyHeight + 'px' console.log('calSize:' + bodyHeight) } } } </script> <style rel="stylesheet/scss" lang="scss" scoped> .container{ height: 600px; width:100%; } .container{ top:0px !important; -webkit-background-size: 100% 100%; background-size: 100% 100%; background-color: black; /*display: flex;*/ /*justify-content: space-between;*/ /*flex-direction: column;*/ } .body{ /*flex:1;*/ position:relative; height:calc(100% - 0.6rem); width:100%; .frame-img{ position: absolute; z-index:1001; width:96%; height:94%; top:50%; left:50%; transform: translate(-51%,-50%); } .frame-div{ position: absolute; z-index:1000; width:96%; height:94%; top:50%; left:50%; transform: translate(-51%,-50%); padding:0.061rem 0.061rem; iframe{ position:relative; width:100%; height:100%; } } } </style>