horizontalSlide.vue 2.25 KB
<template>
  <div class="horizontalSlide">
    <ul class="list-warp">
      <li class="list-item" v-for="(item, index) in value" :key="index">
        <ImageFormat
          class="image"
          src="//img11.static.yhbimg.com/goodsimg/2018/12/28/15/0160a985f0b5999b77436b7af78a85f3df.jpg" alt="加载失败"
          :width="136" :height="180"
          @error="imageformatError"/>
        <div class="info">
          <p class="title">Off-White™ x Nike Air Max 90 全新款「Desert Ore」配色曝光 Off-White™ x Nike Air Max 90 全新款「Desert Ore」配色曝光</p>
          <div class="bottom">
            <span class='icon-ufo'></span>
            <span class="price">¥1299</span>
            <span class="icon-goumai"></span>
          </div>
        </div>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  name: 'horizontalSlide',
  props: ['value'],
  data() {
    return {};
  },

  methods: {
    imageformatError() {
      console.log(6666);
    }
  },
  computed: {},
  components: {}
}
</script>
<style lang="scss" scoped>
.horizontalSlide {
  overflow: hidden;
  overflow-x: scroll;
  -webkit-overflow-scrolling: touch;
  -webkit-overscroll-behavior-x: contain;
  scroll-behavior: smooth;
}
.list-warp {
  overflow-x: scroll;
  width: max-content;
  font-size: 0;
}
.list-item {
  display: inline-flex;
  width: 600px;
  height: 180px;
  margin-right: 24px;
  border-radius: 8px;
  .image {
    min-width: 136px;
    min-height: 180px;
    max-width: 136px;
    max-height: 180px;
    border-radius: 8px 0 0 8px;
    filter: contrast(0.9);
  }
  .title {
    font-size: 24px;
    color: #999;
    line-height: 34px;
    word-break: break-all;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  .bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .info {
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid #F0F0F0;
    border-radius: 0 8px 8px 0;
  }
  .price {
    margin-left: 16px;
    font-size: 28px;
    font-family: 'BrownStd-Regular';
    vertical-align: middle;
    flex: 1 1 auto;
  }
  .icon-goumai {
    float: right;
  }
}
</style>