product-group.vue 1.22 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"
        :pos-id="posId"
        :lazy="lazy"
        :index="index"
        :key="inx">
      </ProductGroupItem>
    </div>
  </div>
</template>

<script>
import ProductGroupItem from './product-group-item';
import {Button} from 'cube-ui';

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
  },
  computed: {
    single() {
      return this.data.length === 1;
    },
  },
  components: {Button, ProductGroupItem}
};
</script>

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

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