<template>
  <div :class="$style['container']">
    <div class="header">
      <div class="title">
        <h1>环境-安全 实时监测系统</h1>
        <dv-decoration-5 style="width: 100%; height: var(--header)"></dv-decoration-5>
      </div>
      <p ref="Timedom">{{ timeHtml }}</p>
    </div>

    <div class="content" ref="Acontent">
        <el-row>
        <el-col :span="12">
        <contentLeft :width="size.oWidth" :height="size.oHeight"></contentLeft>
        </el-col>
        <el-col :span="12">
        <contentRight :width="size.oWidth" :height="size.oHeight"></contentRight>
        </el-col>
        </el-row>
    </div>
  </div>
</template>

<script setup lang="ts">
import { onMounted, onUnmounted, reactive, ref } from "vue";
import contentLeft from './content/left.vue'
import contentRight from './content/right.vue'
import useNowTime from '@/hook/nowTime'
import {calcWH} from '@/components/ts/selfAdaption'
import { ElRow, ElCol } from "element-plus";

let Acontent=ref()
let time=null
let Timedom=ref()
let {timeHtml}=useNowTime()

let size=reactive({
  oWidth:0,
  oHeight:0
});
function WH(div:HTMLElement){
  console.log( div );
  
  let a=calcWH(div.offsetHeight,div.offsetWidth,1,2,0)
  size.oWidth=a.oWidth
  size.oHeight=a.oHeight
}
// 

onMounted(() => {
  let contentBox=Acontent.value
  let Timedombox=Timedom.value
  window.document.title='环境-安全 实时监测系统'
  WH(contentBox)
  window.addEventListener('resize',()=>{
      if(time){
        clearTimeout(time)
      }
      time = setTimeout(() => {WH(contentBox)
      }, 1000);
    })
})

onUnmounted(() => {
  clearTimeout(time)
})

</script>

<style module>
.container {
  height: 1080px;
  width: 1920px;
  color: #20aec5;
  background-color: #100c2a;
}
</style>

<style scoped>
.title {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}
.title > h1 {
  font-size: 30px;
  position: absolute;
  top: 10px;
}
.header{
    position: relative;
}
.header p{
    position: absolute;
    right: 50px;
    bottom: 20px;
    font-size:20px;
}
.content{
    width:100%;
    height:calc(1080px - var(--header))
}
</style>


<style>
body {
  --header:100px;
  /* --content:calc(100vh - var(--header)) */
  overflow: hidden !important;
  -ms-overflow-style: none; /* IE + Edge */
  scrollbar-width: none; /* Firefox */
}
::-webkit-scrollbar {
  display: none;
}
</style>
