<template>
  <div class="product-list">
    <div
      class="product-list-item"
      v-for="(item, index) in productList"
      :key="index"
    >
      <div class="product-list-item-img">
        <a :href="item.linkUrl" target="_black" >
          <img :src="item.imgUrl" :alt="item.title" srcset="">
        </a>
        <div class="product-tag">{{ item.tag }}
        </div>
      </div>
      <div class="product-list-info">
        <div class="product-list-title">
          <a :href="item.linkUrl" target="_black">
            {{ item.title }}
          </a>
          <!-- <nuxt-link to="/">{{ item.title }}</nuxt-link> -->
        </div>
        <div class="product-list-content">
          <div class="product-list-price">
            ￥
            <span class="price-num">{{ item.price }}</span>
          </div>
          <div class="product-list-btn">
            <a :href="item.linkUrl" target="_black">
              查看产品 
            </a>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    productList: {
      type: Array,
      default: function() {
        return [];
      }
    }
  },
  data() {
    return {

    }
  }
}
</script>

<style lang="scss" scoped>
@import "~static/common/style.sass";

.product-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  .product-list-item {
    position: relative;
    box-sizing: border-box;
    width: 374px;
    margin-bottom: 42px;
    margin-right: 36px;
    &:nth-child(3n) {
      margin-right: 0px;
    }
    &:hover {
      transform: scale(1.1);
      transition: transform 1s;
    }
    .product-list-item-img {
      width: 374px;
      height: 250px;
      font-size: 0;
      overflow: hidden;
      &:hover {
        img {
          // transform: scale(1.2);
          // transition: transform 1s;
        }
        .product-tag {
          // border-radius: 0px 0px 0px 0px;
          // transition: border-radius .3s;
        }
      }
      img {
        border-radius: 18px 18px 0px 0px;
        width: 100%;
      }
    }
  }
  .product-tag {
    padding: 0 6px 0 10px;
    background: $theme_color_fu;
    position: absolute;
    top: 0;
    left: 0;
    font-size: 12px;
    color: #ffffff;
    height: 24px;
    line-height: 24px;
    font-family: PingFangSC-Semibold, PingFang SC;
    font-weight: 600;
    border-radius: 18px 0px 7px 0px;
  }
}
.product-list-info {
  box-sizing: border-box;
  background: #ffffff;
  height: 90px;
  box-shadow: 0px 5px 21px 0px rgba(232, 243, 243, 1);
  border-radius: 0px 0px 18px 18px;
  padding: 10px 22px;
  .product-list-title {
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #343E30;
    font-size: 20px;
    font-weight: 400;
    line-height: 28px;
    overflow: hidden;//超出一行文字自动隐藏 
    text-overflow: ellipsis;//文字隐藏后添加省略号
    white-space: nowrap;//强制不换行

    a {
      color: #343e30;
    }
  }
  .product-list-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
  }
  .product-list-price {
    color: #ea0b4a;
    font-size: 20px;
    line-height: 38px;
    .price-num {
      font-size: 30px;
      font-weight: 600;
      line-height: 28px;
    }
  }
  .product-list-btn {
    font-size: 13px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    border: 1px solid rgba(60, 142, 255, 1);
    height: 28px;
    line-height: 28px;
    border-radius: 14px;
    a {
      padding: 0 15px;
      color: #3e8eff;
    }
  }
}
</style>
