fuliqi
2024-01-24 29c1e7eb5ac16e90d8991a86c1c071bc312ec8d9
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
72
73
74
<!--
/**
* @description 图片走马灯组件
* @author huangpan
*/
-->
<template>
  <div class="trottingHorseLampStyle">
    <swiper ref="mySwiper" :options="swiperOptions" v-if="infoData.picData.length">
      <swiper-slide v-for="(item, index) in infoData.picData" :key="index"
                    :style="{width:infoData.width,height:infoData.height}">
        <img :src="item.img" alt="" class="imgs-style"
             :style="{width:infoData.width,height:infoData.height}" />
      </swiper-slide>
      <div class="swiper-pagination" slot="pagination"></div>
    </swiper>
  </div>
</template>
 
<script>
export default {
  name: "PicTrottingHorseLamp",
  data() {
    return {
      swiperOptions: {//轮播图参数配置,参数同swiper官方api参数
        slidesPerView: "auto",//wrapper中显示的图片数量
        spaceBetween: 16,//图片之间间隔
        loop: true,//循环播放
        speed: 1200,//图片切换速度
        autoplay: {
          delay: 0, //自动切换的时间间隔
          disableOnInteraction: false,
          pauseOnMouseEnter: true, //鼠标置于swiper时暂停自动切换,鼠标离开时恢复自动切换。
        }
      },
      infoData: {
        width: '230px',
        height: '250px',
        picData: [
          {
            text: "图一",
            img: require("../../assets/images/p1.png"),
          },
          {
            text: "图二",
            img: require("../../assets/images/p2.png"),
          },
          {
            text: "图三",
            img: require("../../assets/images/p3.png"),
          }
        ],
      }
    }
  },
  computed: {
    swiper() {
      return this.$refs.mySwiper.$swiper
    }
  },
}
</script>
 
<style lang="less">
.trottingHorseLampStyle {
  .swiper-container .swiper-wrapper {
    -webkit-transition-timing-function: linear !important; /*之前是ease-out*/
    -moz-transition-timing-function: linear !important;
    -ms-transition-timing-function: linear !important;
    -o-transition-timing-function: linear !important;
    transition-timing-function: linear !important;
  }
}
</style>