<!-- * @Description: 双创主题大屏布局:1920*1080尺寸 * @Author: 王晓颖 * @Date: 2020-09-01 10:34:35 --> <template> <div ref="container" class="container"> <!--头--> <header2 ref="header"/> <!--内容--> <div ref="body" class="body"> <!--地图图层--> <div class="map-body"> <div class="middle"> <ScMap2D/> </div> </div> </div> </div> </template> <script> import Header2 from '../header/header2' import ScMap2D from '../topic/shuangchuang/components/ScMap2D' export default { name: 'IndexShuangchuang', components: {ScMap2D, Header2}, data () { return { ops: { bar: { showDelay: 1000, // 当不做任何操作时滚动条自动消失的时间 keepShow: false, // 是否保持显示 background: '#cecece', // 滚动条颜色 opacity: 0.5, // 滚动条透明度 size: '.06rem', 'z-index': 21, onlyShowBarOnScroll: false /** 是否只在滚动的时候现实滚动条 */ } }, size: { width: '100%', height: '100%' } } }, mounted () { const that = this window.onload = () => { that.calSize() } window.onresize = () => { that.calSize() } }, methods: { calSize () { const height = document.body.clientHeight const headerHeight = this.$refs.header.$el.clientHeight const bodyHeight = height - headerHeight this.$refs.body.height = bodyHeight console.log('calSize:' + bodyHeight) } } } </script> <style rel="stylesheet/scss" lang="scss" scoped> @media screen and (max-width: 3000px) { .container{ height: 100%; width:100%; } } @media screen and (min-width: 3000px) { .container{ height: 1080px; width:1920px; } } .container{ top:0px !important; background: url("../../assets/images/background2.jpg") no-repeat; -webkit-background-size: 100% 100%; background-size: 100% 100%; background-color: black; } .body{ position:relative; height:calc(100% - 0.6rem); width:100%; } .map-body{ width: 100%; height:100%; position: absolute; z-index: 1; display: flex; justify-content: center; top: 0; .middle{ width:100%; height:100%; display: flex; justify-content: center; div{ flex: 1; } } } </style>