当前位置:   article > 正文

swiper轮播图在vue中实现显示3张图片,一个完整的两边显示一半_vue轮播图三张图片展示

vue轮播图三张图片展示

swiper效果图,图片路径自己更改吧
这个

<template>
    <div id="root" style="overflow: hidden">
      <div class="swiper-container" >
        <div class="swiper-wrapper" >
          <div class="swiper-slide" ><img src="../assets/logo.png" /></div>
          <div class="swiper-slide" ><img src="../assets/logo.png" /></div>
          <div class="swiper-slide" ><img src="../assets/logo.png" /></div>
          <div class="swiper-slide" ><img src="../assets/logo.png" /></div>
          <div class="swiper-slide" ><img src="../assets/logo.png" /></div>
        </div>
      </div>
    </div>
</template>

<script>

  export default {
    components: {

    },
    data(){
      return {
        }
    },
    mounted(){
      this.$nextTick(()=>{
        new Swiper('.swiper-container', {
          loop: true, // 循环模式选项
          loopedSlides: 5,
          // 如果需要分页器
          // pagination: {
          //   el: '.swiper-pagination',
          // },
        })
      })

    }
  }
</script>

<style >
  .swiper-container {
    overflow: visible!important;
    width: 600px;
    height: 300px;
  }
  .swiper-container .swiper-wrapper .swiper-slide{ width: 600px; border-radius: 20px;background: palegreen}
  .swiper-container .swiper-wrapper .swiper-slide img{ border-radius: 20px;}
  .swiper-container .swiper-wrapper .swiper-slide-prev{ margin-top: 18px; height: 284px!important;}
  .swiper-container .swiper-wrapper .swiper-slide-prev img{ height: 284px!important;}
  .swiper-container .swiper-wrapper .swiper-slide-next{ margin-top: 18px; height: 284px!important;}
  .swiper-container .swiper-wrapper .swiper-slide-next img{ height: 284px!important;}
  .swiper-container .swiper-wrapper .swiper-slide-active{ width: 600px;margin-right: 10px;margin-left: 10px}

</style>

  • 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

如皋要实现三张图片等高,删除这几行代码就可以啦

  .swiper-container .swiper-wrapper .swiper-slide-prev{ margin-top: 18px; height: 284px!important;}
  .swiper-container .swiper-wrapper .swiper-slide-prev img{ height: 284px!important;}
  .swiper-container .swiper-wrapper .swiper-slide-next{ margin-top: 18px; height: 284px!important;}
  .swiper-container .swiper-wrapper .swiper-slide-next img{ height: 284px!important;}
  • 1
  • 2
  • 3
  • 4

在这里插入图片描述

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/251174
推荐阅读