|
|
<template> <section :class="['tw-relative tw-mt-[48px] xl:tw-mx-auto']"> <div class="swiper-container focusExhibitionWrapper2 xl:tw-max-w-[1060px] xl:tw-mx-auto" ref="focusExhibitionWrapper2" @mouseenter="enter" @mouseleave="leave"> <div :class="['swiper-wrapper']"> <template v-for="(item, index) in focusExhibitionlist2"> <div :key="index" :class="['swiper-slide tw-p-[10px]']" v-if="item.ExhibitionList.length > 0 && index <=5"> <div class="tw-px-[20px] tw-py-[40px] tw-rounded-[24px] bg-col-to-tr"> <div class="tw-flex tw-flex-col tw-rounded-[24px]"> <div class="tw-flex tw-justify-center" style="width:100%;"> <div class="t18 tw-text-center tw-mb-[20px] tw-font-bold"> {{item.CategoryName}} </div> </div> <div class="tw-justify-center" style="width:100%;"> <template v-if="item.ExhibitionList!=undefined && item.ExhibitionList && item.ExhibitionList.length>0"> <template v-for="(item2, index2) in item.ExhibitionList"> <div v-if="index2<=2" :key="index2" class="tw-py-[10px]"> <skeletonSlot> <focusExhibitionsCard :item="item2" ></focusExhibitionsCard> </skeletonSlot> </div> </template> </template> </div> <nuxt-link :to="localePath(`/exhibition?category=${item.CategoryID}`)" class="tw-flex tw-justify-center tw-mt-[20px]"> <div class="tw-flex-none"> <v-img max-height="21" :src="require(`@/assets/svg/more.svg`)"></v-img> </div> <div class="tw-shrink tw-mx-[10px] tw-text-[#cecece]"> {{$t('Explore more')}} </div> <div class="tw-flex-none"> <v-img max-height="21" :src="require(`@/assets/svg/more.svg`)"></v-img> </div> </nuxt-link> </div> </div> </div> </template> </div> </div> <div :class="[ 'swiper-button-prev ad2 tw-text-black tw-hidden', focusExhibitionWrapper2 ? 'xl:tw-flex xl:tw-justify-center xl:tw-items-center' : '', ]" ></div> <div :class="[ 'swiper-button-next ad2 tw-text-black tw-hidden', focusExhibitionWrapper2 ? 'xl:tw-flex xl:tw-justify-center xl:tw-items-center' : '', ]" ></div> </section> </template> <script> import skeletonSlot from "~/components/newComponent/skeleton/skeletonSlot.vue"; import focusExhibitionsCard from "~/components/home/FocusExhibitionsCard.vue"; import Swiper from "swiper/bundle"; export default { components: { skeletonSlot, focusExhibitionsCard, Swiper, }, props: { focusExhibitionlist2: { type: Array, }, }, data() { return { focusExhibitionWrapper2: null, exhibitions: [], }; }, created() { }, mounted() { let vm = this; vm.$nextTick(function () { vm.focusExhibitionWrapper2 = new Swiper(".swiper-container.focusExhibitionWrapper2", { direction: "horizontal", initialSlide: 0, slidesPerView: 1.2, centeredSlides: true, loop: false, loopedSlides: 0, observer: true, //修改swiper自己或子元素时,自动初始化swiper
observeParents: true, //修改swiper的父元素时,自动初始化swiper
spaceBetween: 32, // autoplay: {
// disableOnInteraction: true,
// delay: 5000,
// },
preloadImages: false, // lazy: {
// loadPrevNext: true,
// loadOnTransitionStart: true,
// loadPrevNextAmount: 6,
// },
watchSlidesProgress: false, navigation: { nextEl: ".swiper-button-next.ad2", prevEl: ".swiper-button-prev.ad2", }, breakpoints: { 768: { slidesPerView: 1.2, spaceBetween: 48, }, 1366: { slidesPerView: 2, spaceBetween: 24, centeredSlides: false, grabCursor: true, }, }, }); vm.focusExhibitionWrapper2.init(); vm.focusExhibitionWrapper2.update(); }); }, methods: { enter() { this.focusExhibitionWrapper2.autoplay.stop(); }, leave() { this.focusExhibitionWrapper2.autoplay.start(); }, }, }; </script> <style lang="scss" scoped> .swiper-container { width: 100% !important; }
.swiper-button { &-prev { left: 0; width: 50px; &::before { content: ""; display: block; width: 50px; height: 50px; border-radius: 50px; background: white; border: 1px solid #e6e6e8; transform: rotate(180deg); }
&:after { content: ""; display: block; position: absolute; right: 15px; background-image: url('~/assets/svg/u-angle-left-b.svg'); background-position: center; background-repeat: no-repeat; background-size: cover; width: 24px; height: 24px; } }
&-next { right: 0; width: 50px; &::before { content: ""; display: block; width: 50px; height: 50px; border-radius: 50px; background: white; border: 1px solid #e6e6e8; }
&:after { content: ""; display: block; position: absolute; left: 15px; background-image: url('~/assets/svg/u-angle-right-b.svg'); background-position: center; background-repeat: no-repeat; background-size: cover; width: 24px; height: 24px; } } }
.bg-col-to-tr{ box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.08); background: linear-gradient(to bottom right, rgba(220, 217, 255, 0.8), rgba(63, 61, 86, 0.6)); } </style>
|