vue-awesome-swiper轮播组件

 安装版本:"swiper": "^6.0.0",

安装版本:"vue-awesome-swiper": "^4.1.1",

  <div class="swiper_conter">
        <swiper class="swiper" :options="swiperOption" ref="mySwiper">
          <swiper-slide
            class="swiper-wrapper"
            v-for="(item, index) in dataList"
            :key="index"
          >
            <div class="swiper-slide" @mouseenter="mouseenterchange(item.pic)">
              <div class="awiper_icon"></div>
              <el-image
                class="multimedia"
                :src="item.pic"
                fit="fill"
              ></el-image>
              <h3 class="dot">{{ item.name }}</h3>
            </div>
          </swiper-slide>
        </swiper>
        <div class="owl-next" @click="swiperNext"></div>
        <div class="owl-prev" @click="swiperPrev"></div>
    </div>
import { Swiper, SwiperSlide } from 'vue-awesome-swiper'
  components: {
    Swiper,
    SwiperSlide,
  },
 data() {
    return {
       dataList:[{pic:'图片',name:'文字'}],
          swiperOption: {
            loop: false,
            slidesPerView: 4,
            spaceBetween: 30,
            navigation: {
              nextEl: '.owl-next',
              prevEl: '.owl-prev',
           },
      },
    }
}
    mouseenterchange(url) {
      console.log('鼠标移入')
    },
    swiperNext() {
      this.$refs.mySwiper.$swiper.slideNext()
    },
    swiperPrev() {
      this.$refs.mySwiper.$swiper.slidePrev()
    },
.swiper_conter {
  position: relative;
  margin: 36px 0 120px;
  padding: 0 30px;
  width: 100%;
  overflow: hidden;
  height: 188px;
  .swiper {
    .swiper-wrapper {
      padding: 0 15px;
      .swiper-slide {
        position: relative;
        .multimedia {
          width: 100%;
          height: 143px;
        }
        .dot {
          border: 1px solid #e8e8e8;
          border-top: 0;
          line-height: 42px;
          padding: 0 3%;
          font-weight: normal;
          font-size: 16px;
          text-align: center;
          white-space: nowrap;
          text-overflow: ellipsis;
          overflow: hidden;
          &:hover {
            background-image: linear-gradient(to top, #c1ac8c 0%, #d3bf9f 100%);
            border-color: #d3bf9f;
            color: #fff;
          }
        }
        .awiper_icon {
          width: 50px;
          height: 50px;
          top: 25%;
          left: 40%;
          z-index: 99;
          position: absolute;
          background: url('https://www.yglock.com/cn/images/PicList002173-icon_video.png')
            no-repeat center center;
        }
      }
    }
  }
  .owl-prev {
    position: absolute;
    width: 28px;
    height: 28px;
    top: 50%;
    margin-top: -14px;
    left: 0;
    background: url('https://www.yglock.com/cn/images/PicList002173-btn.png')
      no-repeat left bottom;
    cursor: pointer;
  }
  .owl-next {
    position: absolute;
    width: 28px;
    height: 28px;
    top: 50%;
    margin-top: -14px;
    right: 0;
    background: url('https://www.yglock.com/cn/images/PicList002173-btn.png')
      no-repeat right bottom;
    cursor: pointer;
  }
}

  • 9
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值