You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
frontend/src/views/components/carouselChart2.vue

127 lines
2.9 KiB
Vue

<template>
2 years ago
<div class="thumb-example2">
<swiper
class="swiper gallery-top"
:options="swiperOptionTop"
ref="swiperTop"
>
<swiper-slide
:class="`slide-${index + 1}`"
v-for="(item, index) in terminalPhoto"
:key="item.id"
v-bind:style="{
'background-image': 'url(' + item.path + ')',
}"
></swiper-slide>
<!-- <swiper-slide class="slide-2"></swiper-slide>
<swiper-slide class="slide-3"></swiper-slide>
<swiper-slide class="slide-4"></swiper-slide>
<swiper-slide class="slide-5"></swiper-slide> -->
<div
class="swiper-button-next swiper-button-white"
slot="button-next"
></div>
<div
class="swiper-button-prev swiper-button-white"
slot="button-prev"
></div>
</swiper>
<!-- swiper2 Thumbs -->
<swiper
class="swiper gallery-thumbs"
:options="swiperOptionThumbs"
ref="swiperThumbs"
>
<swiper-slide
:class="`slide-${index + 1}`"
v-for="(item, index) in terminalPhoto"
:key="item.id"
v-bind:style="{
'background-image': 'url(' + item.path + ')',
}"
></swiper-slide>
</swiper>
</div>
</template>
2 years ago
<script>
2 years ago
import { Swiper, SwiperSlide } from "vue-awesome-swiper";
import "swiper/css/swiper.css";
export default {
2 years ago
name: "swiper-example-thumbs-gallery",
title: "Thumbs gallery with Two-way control",
components: {
Swiper,
SwiperSlide,
},
props: {
terminalPhoto: {
type: Array,
default: () => [],
},
},
data() {
return {
swiperOptionTop: {
loop: true,
loopedSlides: 5, // looped slides should be the same
spaceBetween: 10,
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
},
swiperOptionThumbs: {
loop: true,
loopedSlides: 5, // looped slides should be the same
spaceBetween: 10,
centeredSlides: true,
slidesPerView: "auto",
touchRatio: 0.2,
slideToClickedSlide: true,
},
};
},
mounted() {
this.$nextTick(() => {
2 years ago
const swiperTop = this.$refs.swiperTop.$swiper;
const swiperThumbs = this.$refs.swiperThumbs.$swiper;
swiperTop.controller.control = swiperThumbs;
swiperThumbs.controller.control = swiperTop;
});
},
};
</script>
2 years ago
<style lang="less" scoped>
2 years ago
.thumb-example2 {
height: 480px;
background-color: #000;
.swiper {
.swiper-slide {
background-size: cover;
background-position: center;
}
2 years ago
&.gallery-top {
height: 80%;
width: 100%;
}
&.gallery-thumbs {
height: 20%;
box-sizing: border-box;
padding: 10px 0;
}
&.gallery-thumbs .swiper-slide {
width: 25%;
height: 100%;
opacity: 0.4;
}
&.gallery-thumbs .swiper-slide-active {
opacity: 1;
}
}
}
</style>