<template>
  <Box title="监控">
    <div class="h-full flex flex-col">
      <div class="py-10px">
        <ul class="flex items-center justify-center m-0">
          <li
            class="mx-11px text-white text-12px cursor-pointer"
            :class="{ active: currentTab == item.key }"
            @click="changeTab(item.key)"
            v-for="item in tabList"
            :key="item.key"
            >{{ item.value }}</li
          >
        </ul>
      </div>
      <div class="flex-1 px-11px">
        <div class="h-196px border border-solid"></div>
        <div class="grid grid-cols-3 gap-x-6px mt-10px">
          <div class="border border-solid h-66px"></div>
          <div class="border border-solid h-66px"></div>
          <div class="border border-solid h-66px"></div>
        </div>
      </div>
    </div>
  </Box>
</template>

<script lang="ts">
  import { defineComponent, reactive, ref, Ref, onMounted } from 'vue'
  import Box from './Box.vue'
  export default defineComponent({
    components: {
      Box,
    },
    setup() {
      const tabList = reactive([
        {
          key: '0',
          value: '基地1',
        },
        {
          key: '1',
          value: '基地2',
        },
        {
          key: '2',
          value: '基地3',
        },
      ])

      const currentTab = ref<String>('0')

      const chartRef = ref<HTMLDivElement | null>(null)

      const changeTab = (key: String) => {
        if (currentTab.value == key) return
        currentTab.value = key
      }

      onMounted(() => {})

      return {
        tabList,
        currentTab,
        chartRef,
        changeTab,
      }
    },
  })
</script>

<style scoped lang="less">
  .active {
    @apply font-bold text-15px text-[#76E9F0];
  }
</style>
