Vue3+swiper实现平铺轮播图
vue
vuejs/vue: 是一个用于构建用户界面的 JavaScript 框架,具有简洁的语法和丰富的组件库,可以用于开发单页面应用程序和多页面应用程序。
项目地址:https://gitcode.com/gh_mirrors/vu/vue
免费下载资源
·
<Swiper
ref="swiperRef"
:modules="modules"
:loop="true"
:loopAdditionalSlides="3"
:centeredSlides="true"
:initialSlide="1"
:slidesPerView="3"
:spaceBetween="10"
:updateOnWindowResize="true"
:watchSlidesProgress="true"
:navigation="navigation"
:pagination="{ clickable: true }"
:autoplay="{
delay: 3000,
disableOnInteraction: false,
}"
:speed="1000"
:effect="'fade'"
:grabCursor="true"
class="swiper-container"
@slideChange="onSlideChange"
>
<SwiperSlide class="swiper-slide">
<img src="@/assets/images/contentus/zl1.png" alt="" />
</SwiperSlide>
<SwiperSlide class="swiper-slide">
<img src="@/assets/images/contentus/zl2.png" alt="" />
</SwiperSlide>
<SwiperSlide class="swiper-slide">
<img src="@/assets/images/contentus/zl3.png" alt="" />
</SwiperSlide>
<SwiperSlide class="swiper-slide">
<img src="@/assets/images/contentus/zl4.png" alt="" />
</SwiperSlide>
<div
class="swiper-button-prev"
@click.stop="prevEl(item, index)"
></div>
<div class="swiper-button-next" @click.stop="nextEl"></div>
</Swiper>
/* 初始状态下隐藏切换按钮 */
.swiper-button-next,
.swiper-button-prev {
opacity: 0;
transition: opacity 0.3s ease;
}
:deep(.swiper-pagination) {
opacity: 0;
transition: opacity 0.3s ease;
}
/* 当鼠标悬停在swiper容器上时显示切换按钮 */
.swiper-container:hover .swiper-button-next,
.swiper-container:hover .swiper-button-prev {
// background-image: url('@/assets/images/architect/icon_3.png');
opacity: 1;
}
:deep(.swiper-container:hover .swiper-pagination) {
opacity: 1;
}
.swiper {
margin-left: auto;
margin-right: auto;
position: relative;
box-sizing: border-box;
}
.swiper-wraper {
width: 100%;
height: 100%;
z-index: 1;
display: flex;
box-sizing: content-box;
}
.swiper-slide {
flex-shrink: 0;
width: 100%;
height: 100%;
img {
width: 55vh;
}
}
.swiper-slide-imgbox {
opacity: 1;
box-sizing: border-box;
}```
GitHub 加速计划 / vu / vue
207.55 K
33.66 K
下载
vuejs/vue: 是一个用于构建用户界面的 JavaScript 框架,具有简洁的语法和丰富的组件库,可以用于开发单页面应用程序和多页面应用程序。
最近提交(Master分支:3 个月前 )
73486cb5
* chore: fix link broken
Signed-off-by: snoppy <michaleli@foxmail.com>
* Update packages/template-compiler/README.md [skip ci]
---------
Signed-off-by: snoppy <michaleli@foxmail.com>
Co-authored-by: Eduardo San Martin Morote <posva@users.noreply.github.com> 5 个月前
e428d891
Updated Browser Compatibility reference. The previous currently returns HTTP 404. 5 个月前
更多推荐
已为社区贡献2条内容
所有评论(0)