<template>
  <view class="grid-item" @click="handleClick">
    <image :src="item.imageUrl" class="item-image"></image>
    <view class="item-title">{{ item.title }}</view>
    <view class="item-info">
      <text class="item-price">已筹 ¥{{ item.raisedAmount }}万</text>
      <text class="item-supporters">支持者 {{ item.supporters }}</text>
    </view>
  </view>
</template>

<script>
export default {
  name: 'CrowdFundingItem',
  props: {
    item: {
      type: Object,
      required: true
    }
  },
  methods: {
    handleClick() {
      this.$emit('click', this.item.id);
    }
  }
}
</script>

<style scoped lang="scss">
.grid-item {
  background: #fff;
  border-radius: 20rpx;
  overflow: hidden;
  box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
  margin-bottom: 8rpx;
  .item-image {
    width: 100%;
    height: 220rpx;
    display: block;
    object-fit: cover;
    border-top-left-radius: 20rpx;
    border-top-right-radius: 20rpx;
  }
  .item-title {
    font-size: 26rpx;
    color: #222;
    padding: 12rpx 12rpx 0 12rpx;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .item-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 12rpx 12rpx 12rpx;
    font-size: 22rpx;
    .item-price {
      color: #ff5000;
      font-weight: bold;
    }
    .item-supporters {
      color: #999;
    }
  }
}
</style> 