product-list.vue 641 B

123456789101112131415161718192021222324252627
  1. <template>
  2. <view class="product-list-container">
  3. <ProductItem v-for="item in productList" :key="item.id" :product="item"></ProductItem>
  4. </view>
  5. </template>
  6. <script lang="ts" setup>
  7. import { ProductSimpleType } from '@/types/product-type'
  8. import data from './data.json'
  9. import ProductItem from './product-item.vue'
  10. defineOptions({
  11. name: 'ProductList',
  12. })
  13. const productList = ref<ProductSimpleType[]>(data)
  14. </script>
  15. <style lang="scss" scoped>
  16. .product-list-container {
  17. box-sizing: border-box;
  18. display: flex;
  19. flex-wrap: wrap;
  20. justify-content: space-between;
  21. padding-right: 32rpx;
  22. }
  23. </style>