uniapp 轮播列表左右滑动,滑动到中间放大

html

javascript 复制代码
	<!-- 轮播 -->
					<view class="heade">
						<swiper class="swiper" display-multiple-items='3' circular='true' previous-margin='1rpx'
							next-margin='1rpx' current='0' @change="swiperChange" >
							<block v-for="(item,index) in list" :key='index'>
								<swiper-item class="sitem">
									<view class="swiper-item" :class="{current:index==currentIndex}">
										<text class="u-f-s-26 weight-500 u-color-1D1">初级会员{{index}}--{{currentIndex}}</text>
										<view class="u-color-FE6 weight-600 u-f-s-40 u-m-t-16"><text class="u-f-s-24 weight-400">¥</text> 99.00</view>
										<view class="u-color-646 u-f-s-20 u-m-t-16">有效期30天</view>
									</view>
								</swiper-item>
							</block>
						</swiper>
					</view>
					<!-- 轮播 -->

javascript

javascript 复制代码
export default {
	data() {
			return {
				currentIndex: 1,
				list:[1,2,3,4,5,6,7,8,9,10],
				
			}
		},
	methods:{
		swiperChange(event) {
			let a = 1;
			if (event.detail.current == (Number(this.list.length)- 1))  {
				// 滑动到最后一个时,  currentIndex 和 数组的下标 index 相等
				a = -(Number(this.list.length)- 1)
			}
			this.currentIndex = event.detail.current + a;
		}
	}
}

css

javascript 复制代码
/* 轮播图 */
	.heade {
			height: 300rpx;
			position: relative;
		}
	 
		.sitem {
			box-sizing: border-box;
			display: flex;
			justify-content: center;
			align-items: center;
		}
	 
		.swiper {
			width: 100vw;
			position: absolute;
			bottom: 0;
			left: 0;
		}
		.current {
			transform: scale(1.15);
			position: absolute;
			background: #FFF7F0 !important;
			border: 2rpx solid #FFAA9A !important;
			top: 6rpx;
			left: 0rpx;
			right:0rpx;
			z-index: 10;
			transition: all 0.2s ease-in 0s;
			border-radius: 16rpx;
		}
		uni-swiper-item {
			overflow: inherit;
		}
		.swiper-item {
			box-sizing: border-box;
			position: relative;
			background: #FCFCFF;
			border-radius: 16rpx;
			border: 2rpx solid #DFE4E9;
			padding: 24rpx;
			text-align: center;
		}
相关推荐
Q_Q51100828518 小时前
python+uniapp基于微信小程序的学院设备报修系统
spring boot·python·微信小程序·django·flask·uni-app
ღ᭄ꦿ࿐Never say never꧂20 小时前
微信小程序 Button 组件 open-type 完全指南:从用户信息获取到客服分享的实战应用
spring boot·微信小程序·小程序·uni-app·vue3
你真的可爱呀21 小时前
uniapp学习【路由跳转 +数据请求+本地存储+常用组件】
前端·学习·uni-app
2501_915106321 天前
iOS 26 APP 性能测试实战攻略:多工具组合辅助方案
android·macos·ios·小程序·uni-app·cocoa·iphone
00后程序员张1 天前
iOS混淆与IPA文件加固全流程实战 防止苹果应用被反编译的工程级方案
android·ios·小程序·https·uni-app·iphone·webview
草字2 天前
uniapp 打开横竖屏。usb调试时可以横竖屏切换,但是打包发布后却不行?
java·前端·uni-app
2501_915106322 天前
iOS 应用加固与苹果软件混淆指南,如何防止 IPA 被反编译与二次打包?
android·ios·小程序·https·uni-app·iphone·webview
赵庆明老师2 天前
Uniapp微信小程序开发:全局变量的使用
微信小程序·小程序·uni-app
2501_915921432 天前
iOS 应用加固与苹果软件混淆全解析 IPA 文件防反编译、混淆加密与无源码加固策略
android·macos·ios·小程序·uni-app·cocoa·iphone
Jyywww1212 天前
uniapp uni.chooseImage+uni.uploadFile使用方法与详解
开发语言·javascript·uni-app