<script setup>
const props = defineProps({
  data: [],
})

const imageData = ref([
  // {
  //   img: "/images/dsj/ptgk1.png",
  //   name: "项目总数",
  //   value: "689"
  // },
  // {
  //   img: "/images/dsj/ptgk2.png",
  //   name: "设备总数",
  //   value: "18"
  // },
  // {
  //   img: "/images/dsj/ptgk3.png",
  //   name: "在线设备数",
  //   value: "3"
  // },
  // {
  //   img: "/images/dsj/ptgk4.png",
  //   name: "离线设备数",
  //   value: "3"
  // }
])

watch(
  () => props.data,
  (newVal, oldVal) => {
    if (newVal)
      imageData.value = newVal
  },
  { immediate: true },
)
</script>

<template>
  <!-- <div class="ptgkDiv p-3 flex justify-center items-center space-x-8">
    <div v-for="(item, index) in imageData" :key="index">
      <div class="value">
        {{ item.value }}
      </div>
      <div class="name mt-1 mb-3">
        {{ item.name }}
      </div>
      <img :src="item.img" alt="">
    </div>
  </div> -->
  <div class="ptgkDiv p-3 grid grid-cols-3 gap-1">
    <div v-for="(item, index) in imageData" :key="index" class="flex items-center">
      <img :src="item.img" alt="">
      <div class="flex-1">
        <div class="value">{{ item.value }}</div>
        <div class="name">{{ item.name }}</div>
      </div>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.ptgkDiv {
  font-weight: 400;
  text-align: center;
  .value {
    color: #66ffff;
    font-size: 1.75rem;
    line-height: 2.5rem;
  }
  .name {
    font-size: 0.875rem;
    line-height: 1.5rem;
    color: #fff;
  }
  img {
    height: 3rem;
  }
}
</style>
