<template>
  <n-card class="info-box">
    <template #cover>
      <img :src="cover" />
    </template>
    <!-- <div class="cover" :style="{ backgroundImage: `url(${cover})` }"></div> -->
    <div class="info-line">
      <div class="title">{{ title }}</div>
      <div class="time-line">
        <span> {{ time }}</span>
        <div class="see-more" @click="$router.push(`/info-detail/${id}`)">
          查看
        </div>
      </div>
    </div>
  </n-card>
</template>
<script setup>
defineOptions({
  name: "info-box",
});

defineProps({
  id: {
    type: [Number, String],
    default: () => NaN,
  },
  title: {
    type: [String, undefined],
    default: () => "",
  },
  cover: {
    type: [String, undefined],
    default: () => "",
  },
  time: {
    type: [String, undefined],
    default: () => "",
  },
});
</script>
<style lang="scss" scoped>
.n-card.info-box {
  padding: 10px;
  --n-padding-left: 0 !important;
  --n-padding-bottom: 0 !important;
  .cover {
    min-height: 250px;
    background-color: gray;
  }
  .title {
    font-size: 28px;
  }
  .info-line {
    display: flex;
    flex-direction: column;
    .time-line {
      width: 100%;
      flex: 1;
      display: flex;
      justify-content: space-between;
      .see-more {
        cursor: pointer;
      }
    }
  }
}
</style>
