element-plus + vue3实现卡片无缝滚动效果

第一步:在components文件夹下新建Carousel.vue的文件,代码如下
<template>
	<div class="w_100 h_100 carousel_box">
		<template v-if="data.length > 1">
			<div class="arrow left-a d-f ai-c jc-c" @click="arrowPrev">
				<el-icon :size="24"><ArrowLeft /></el-icon>
			</div>
			<div class="arrow right-a d-f ai-c jc-c" @click="arrowNext">
				<el-icon :size="24"><ArrowRight /></el-icon>
			</div>
		</template>

		<el-carousel ref="carouselRef" indicator-position="none" :autoplay="false" arrow="never">
			<el-carousel-item v-for="(item, index) in data" :key="index">
				<div class="apply_box d-f jc-sb fxw-w pb-10">
					<template v-for="card in item" :key="card">
						<!-- 卡片组件 -->
						<ApplyCard :data="card" />
					</template>
					<div class="apply_box_zhan"></div>
				</div>
			</el-carousel-item>
		</el-carousel>
	</div>
</template>

<script setup>
	import {
   
    reactive, ref } from 'vue'
	import {
   
    ArrowRight, ArrowLeft } from '@element-plus/icons-vue'

	import ApplyCard from './ApplyCard.vue'
	const props = defineProps({
   
   
		data: {
   
   
			type: Arr
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值