product-group.vue 1.33 KB
<template>
  <div class="product-group">
    <div class="product-group-scroll">
      <ProductGroupItem
        v-for="(product, inx) in data"
        :share="share"
        :thumb="thumb"
        :single="single"
        :product="product"
        :article-id="articleId"
        :model="model"
        :pos-id="posId"
        :name="name"
        :lazy="lazy"
        :index="index"
        :key="inx">
      </ProductGroupItem>
    </div>
  </div>
</template>

<script>
import ProductGroupItem from './product-group-item';

export default {
  name: 'ProductGroup',
  props: {
    data: {
      type: Array,
      default() {
        return [];
      }
    },
    lazy: {
      type: Boolean,
      default: true
    },
    articleId: {
      type: [String, Number],
    },
    share: Boolean,
    thumb: Boolean,
    posId: Number,
    index: Number,
    model: String,
    name: String
  },
  computed: {
    single() {
      return this.data.length === 1;
    },
  },
  components: {ProductGroupItem}
};
</script>

<style lang="scss" scoped>
.product-group {
  margin: 40px 0;
  overflow-y: hidden;

  &:after {
    content: "";
    display: block;
    margin-top: -79px;
  }
}

.product-group-scroll {
  width: 100%;
  padding-bottom: 80px;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
}
</style>