hot.vue 2.27 KB
<template>
  <div class="hot" v-if="list.length > 0">
    <ul>
      <li v-for="(item, index) in list" :key="index">
        <LayoutLink :href="item.url" class="img-link" :report="{PAGE_URL, ...item.reportParams}" reportEvent="XY_UFO_MAIN_EVENT">
          <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>
        </LayoutLink>
      </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,
    },
    PAGE_URL: {
      type: String,
    }
  },
  components: {
    ImgSize,
  },
  methods: {
    // goProduct(item) {
    //   console.log(item);
    //   return false;
    //   this.$router.push({ 
    //     name: 'List', 
    //     query: {series: item.series_id }
    //   });
    // },

    goMore() {
      this.$router.push({ path: 'category' });
      let reportMoreParams = {...this.list[0].reportParams, PAGE_URL: this.PAGE_URL}
      reportMoreParams.I_INDEX = 0
      console.log(reportMoreParams)
      this.$store.dispatch('reportYas', {
        params: {
          appop: 'XY_UFO_MAIN_EVENT',
          param:reportMoreParams
        }
      });
    }
  }
};
</script>

<style lang="scss" scoped>
.hot {
  margin: 60px 0 40px 0;
  ul {
    overflow: hidden;
    li {
      width: 25%;
      float: left;
      text-align: center;
      .hot-image {
        width: 100px;
        height: 100px;
        overflow: hidden;
        margin: 0 auto;
        img {
          width: 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: 20px;
        }
      }
    }
  }
}
</style>