<template>
  <div class="activity-item" @click="onClick">
    <div class="activity-item-main">
      <div class="activity-item-title line-clamp">{{ data.activity_name }}</div>
      <p class="activity-item-views">{{ data.views }}次浏览</p>
    </div>
    <div class="activity-item-pic" v-if="data.activity_image">
      <img :src="data.activity_image" />
    </div>
  </div>
</template>

<script>
export default {
  name: 'ActivityItem',
  props: { data: Object },
  methods: {
    onClick() {
      this.$router.push({ name: 'activityItem', params: { id: this.data.id } })
    }
  }
}
</script>
<style lang="scss" scoped>
.activity-item {
  display: flex;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid #f1f1f1;
}
.activity-item-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}
.activity-item-title {
  font-size: 14px;
  color: #222;
}
.activity-item-views {
  margin-top: 14px;
  font-size: 12px;
  color: #999;
}
.activity-item-pic {
  width: 120px;
  height: 78px;
  margin-left: 10px;
  overflow: hidden;
  img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}
</style>
