<!--
  Description: 首页
  Author: 李亚光
  Date: 2023-04-23
 -->
<script lang="ts" setup name="dashboard">
import guadmap from './map/index.vue'
import useWebsocketStore from '@/store/modules/websocket'
const websocket = useWebsocketStore()
// 页面高度
const mainHeight = ref(document.body.clientHeight - 50)
// 高度随页面resize变化
window.addEventListener('resize', () => {
  const bodyHeight = document.body.clientHeight - 50
  mainHeight.value = bodyHeight
})
const loading = ref(true)
const offLoading = () => {
  loading.value = false
}
onMounted(() => {
  loading.value = true
  // 连接websocket
  // websocket.initWebSocket()
})
</script>

<template>
  <div :style="{ height: `${mainHeight}px` }" class="container-dashboard">
    <!-- 地图 -->
    <guadmap :onload="offLoading" />
  </div>
</template>

 <style lang="scss" scoped>
  .container-dashboard {
    margin-top: -1px;
  }
 </style>
