ZhangXianQiang
2024-02-29 b0a100049a8b54463519c53c06c6a10e64de95ab
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<template>
  <div class="swiper_button mr-1" @click="prevSwiper">
    <img :src="leftIcon" class="">
  </div>
  <Swiper :slides-per-view="3" :space-between="18" class="image_swiper" @swiper="setSwiper" >
    <SwiperSlide v-for="(slide, index) in imageList" :key="index" class="image_slide" >
      <img :src="slide" class="item_img" @click="imageClick">
    </SwiperSlide>
  </Swiper>
 
  <div class="swiper_button ml-1" @click="nextSwiper">
    <img :src="rightIcon">
  </div>
</template>
 
<script setup>
import Viewer from 'viewerjs';
import { Swiper, SwiperSlide } from 'swiper/vue';
import leftIcon from '@/assets/img/icon/arrow_left.png';
import rightIcon from '@/assets/img/icon/arrow_right.png';
 
import { defineProps,ref } from 'vue';
 
const imgView = null;
const swiperRef = ref(null);
const props = defineProps({
  imageList: {
    type: Array,
    required: true
  }
})
const setSwiper = (swiper) => {
  swiperRef.value = swiper;
}
 const prevSwiper = () => {
  swiperRef.value.slidePrev();
 }
 
 const nextSwiper = () => {
  swiperRef.value.slideNext();
 }
 
 const imageClick = (event) => {
  new Viewer(event.target);
 }
 
</script>
 
<style lang="scss" scoped>
.image_swiper {
  width: 380px;
}
 
.swiper-slide.image_slide {
  width: 102px;
  height: 124px;
  overflow: hidden;
}
 
.item_img {
  display: block;
  height: 100%;
  object-fit: fill;
  cursor: pointer;
}
 
.swiper_button {
  cursor: pointer;
}
 
</style>