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
| <template> <block> <swiper class="swiper-block" :autoplay="false" :circular="true" previous-margin="90rpx" next-margin="90rpx" current="0" @change="swiperChange"> <block v-for="(item, index) in swiperImgUrls" :key="index"> <swiper-item class="swiper-item"> <image mode="aspectFill" :src="item" :class="'slide-image ' + (swiperIndex == index ? 'active' : '')" /> </swiper-item> </block> </swiper> </block> </template>
<script> // index.js // 获取应用实例 const app = getApp(); export default { data() { return { swiperImgUrls: [ 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-f184e7c3-1912-41b2-b81f-435d1b37c7b4/1ae87107-2943-4ba6-be2b-390ca27c6260.png', 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-f184e7c3-1912-41b2-b81f-435d1b37c7b4/1ae87107-2943-4ba6-be2b-390ca27c6260.png', 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-f184e7c3-1912-41b2-b81f-435d1b37c7b4/1ae87107-2943-4ba6-be2b-390ca27c6260.png' ], swiperIndex: 0 }; }, onLoad: function(options) {}, methods: { swiperChange(e) { const that = this; that.swiperIndex = e.detail.current } } }; </script> <style> .swiper-block { height: 300rpx; width: 100%; }
.swiper-item { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; overflow: unset; }
.slide-image { height: 250rpx; width: 520rpx; border-radius: 9rpx; box-shadow: 0px 0px 30rpx rgba(0, 0, 0, 0.2); margin: 0rpx 30rpx; z-index: 1; }
.active { transform: scale(1.14); transition: all 0.2s ease-in 0s; z-index: 20; } </style>
|