<template>
  <div class="classification-content-con">
    <transition name="van-fade">
      <div class="img-con" v-show="show" @click="handleClick({categoryId})">
        <img class="img" :src="cover" />
      </div>
    </transition>
    <div class="list-con flex-default">
      <template v-for="(item, index) of list">
        <transition name="van-fade" :key="'class-item-' + index">
          <div class="item flex-default" v-show="show">
            <!-- <img
              class="img"
              :src="item.thumb"
              @click="handleClick(item)"
            /> -->
            <div class="name" @click="handleClick(item)">{{ item.name }}</div>
          </div>
        </transition>
      </template>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    show: {
      type: Boolean,
      default: false,
    },
    cover: {
      type: String,
      default: "",
    },
    list: {
      type: Array,
      default: () => [],
    },
    categoryId: String
  },
  data() {
    return {};
  },
  methods: {
     handleClick(item) {
       console.log(item)
      let query = { searchKey: "", categoryId: item.categoryId };
      this.$router.push({ name: "search-result", query });
    },
  },
};
</script>

<style lang="less">
.classification-content-con {
  height: 100%;
  overflow-y: auto;

  .img-con {
    padding: 0 15px;
    width: 100%;
    margin-bottom: 15px;
    .img {
      width: 100%;
      height: 78px;
      background-color: #ffffff;
      border-radius: 8px;
      object-fit: cover;
    }
  }

  .list-con {
    flex-wrap: wrap;

    .item {
      width: 50%;
      flex-direction: column;
      align-items: center;
      margin-bottom: 10px;
    }

    .item .img {
      border-radius: 8px;
      height: 60px;
      width: 60px;
      background-color: #ffffff;
      margin-bottom: 3px;
      object-fit: cover;
    }

    .item .name {
      font-size: 12px;
      width: 115px;
      height: 34px;
      line-height: 34px;
      text-align: center;
      background: #FFFFFF;
      border-radius: 2px;
    }
  }
}
</style>
