hot.vue 1.77 KB
<template>
  <div class="hot" v-if="list.length > 0">
    <ul>
      <li v-for="(item, index) in list" :key="index" @click="goProduct(item)">
        <div class="hot-image">
          <ImageFormat :lazy="false" class="item-imge" :src="item.src" :alt="item.alt" :width="100" :height="100"></ImageFormat>
        </div>
        <div class="hot-name">{{item.title}}</div>
      </li>
      <li @click="goMore" class="goMore">
        <div class="hot-image">更多</div>
        <div class="hot-name">MORE</div>
      </li>
    </ul>
  </div>
</template>

<script>
import ImgSize from '../../../../components/img-size';

export default {
  name: 'hot',
  props: {
    list: {
      type: Array,
      default: true,
    },
    
  },
  components: {
    ImgSize,
  },
  methods: {
    goProduct(item) {
      this.$router.push({ 
        path: 'List', 
        query: {series: item.series_id }
      });
    },

    goMore() {
      this.$router.push({ path: 'category' });
    }
  }
};
</script>

<style lang="scss" scoped>
.hot {
  margin: 40px 0;
  ul {
    overflow: hidden;
    li {
      width: 25%;
      float: left;
      text-align: center;
      margin-top: 20px;
      .hot-image {
        width: 150px;
        height: 100px;
        overflow: hidden;
        margin: 0 auto;
        img {
          width: 100%;
          height: 100%;
          display: block;
        }
      }
      .hot-name {
        margin-top: 20px;
        font-size: 24px;
        color: #555;
      }
      &.goMore {
        .hot-image {
          width: 88px;
          height: 56px;
          line-height: 56px;
          border: 1px solid #eee;
          border-radius: 8px;
          font-size: 22px;
          margin-top: 25px;
        }
        .hot-name {
          margin-top: 38px;
        }
      }
    }
  }
}
</style>