You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
zhishifufei_uniapp/components/Carousel/index.vue

75 lines
1.4 KiB

10 months ago
<template>
<view class="carousel">
<swiper id="swiper1" class="swiper-container" indicator-dots circular autoplay>
<swiper-item v-for="item in bannerList" :key="item.id" class="swiper-slide">
<navigator :url="item.url" hover-class="none">
<image :src="item.pic" mode="aspectFill" />
</navigator>
</swiper-item>
</swiper>
</view>
</template>
<script>
export default {
props: {
bannerList: {
type: Array,
default: () => [],
},
},
};
</script>
<style lang="scss" scoped>
.carousel {
padding-right: 30rpx;
padding-left: 30rpx;
// background-color: #ffffff;
}
.carousel .swiper-container {
border-radius: 32rpx;
height: 316rpx;
}
.carousel image {
display: block;
width: 100%;
height: 316rpx;
border-radius: 32rpx;
overflow: hidden;
object-fit: cover;
}
.carousel .swiper-pagination {
font-size: 0;
}
.carousel .swiper-container-horizontal>.swiper-pagination-bullets,
.carousel .swiper-pagination-custom,
.carousel .swiper-pagination-fraction {
bottom: 20rpx;
}
.carousel .swiper-container-horizontal>.swiper-pagination-bullets .swiper-pagination-bullet {
margin: 0 5rpx;
}
.carousel .swiper-pagination-bullet {
width: 10rpx;
height: 10rpx;
border-radius: 5rpx;
background: #b4b4b4;
opacity: 0.5;
}
.carousel .swiper-pagination-bullet-active {
width: 20rpx;
background: #2c8eff;
opacity: 1;
}
</style>