You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
1.5 KiB

2 years ago
  1. <template>
  2. <v-responsive max-width="1365" class="mx-auto">
  3. <v-container>
  4. <v-carousel
  5. v-model="activeIndex"
  6. height="auto"
  7. class="exhibition-swiper mt-5"
  8. hide-delimiters
  9. cycle
  10. >
  11. <v-carousel-item
  12. v-for="(caRow, i) in displayCarouselRows"
  13. :key="`ca_item_${i}`"
  14. >
  15. <v-row>
  16. <v-col v-for="(ad, index) in ads.slice(0, 3)" :key="index" cols="4">
  17. <a :href="ad.url">
  18. <v-img
  19. width="100%"
  20. :src="ad.image"
  21. class="mx-auto rounded-xl my-auto"
  22. />
  23. </a>
  24. </v-col>
  25. </v-row>
  26. </v-carousel-item>
  27. </v-carousel>
  28. </v-container>
  29. </v-responsive>
  30. </template>
  31. <script>
  32. export default {
  33. props: ["ads"],
  34. name: "ExhibitionCarousel",
  35. data: () => ({
  36. activeIndex: 0,
  37. carouselItems: Array(15).fill(1),
  38. }),
  39. computed: {
  40. displayCarouselRows() {
  41. const { carouselItems } = this;
  42. const ret = [];
  43. for (let i = 0; i < carouselItems.length; i += 3) {
  44. ret.push([
  45. carouselItems[i],
  46. carouselItems[i + 1],
  47. carouselItems[i + 2],
  48. ]);
  49. }
  50. return ret;
  51. },
  52. },
  53. };
  54. </script>
  55. <style lang="scss">
  56. .exhibition-swiper {
  57. padding: 0 96px;
  58. .v-window__prev {
  59. left: auto;
  60. right: 100%;
  61. }
  62. .v-window__next {
  63. right: auto;
  64. left: 100%;
  65. }
  66. }
  67. </style>